Bug 517658 - When adding MozOrientation listener, the listener is called only after there is orientation change, r=dougt

This commit is contained in:
Olli Pettay 2009-09-24 20:54:10 +03:00
parent dc3936158f
commit af4c497fa8

View File

@ -197,8 +197,18 @@ NS_IMETHODIMP nsAccelerometer::RemoveWindowListener(nsIDOMWindow *aWindow)
void
nsAccelerometer::AccelerationChanged(double x, double y, double z)
{
if (x > 1 || y > 1 || z > 1 || x < -1 || y < -1 || z < -1)
return;
if (x > 1)
x = 1;
if (y > 1)
y = 1;
if (z > 1)
z = 1;
if (x < -1)
x = -1;
if (y < -1)
y = -1;
if (z < -1)
z = -1;
if (!mNewListener) {
if (PR_ABS(mLastX - x) < .01 &&