Open Bug 513910 Opened 15 years ago Updated 2 years ago

Orientation should report total force in g

Categories

(Core :: Widget, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: dougt, Unassigned)

References

Details

Orientation should report total force in g.  currently we may be bounding the force between -1 and 1.

http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/events/nsIDOMOrientationEvent.idl#48

We should fix the IDL, and review the widget implementations to ensure we aren't doing anything dumb.
Actually, do we want to report force or position?
In http://mxr.mozilla.org/mozilla-central/source/widget/src/xpwidgets/nsAccelerometer.cpp#198

The check for if x, y and z are within [-1;1] should at least be moved down after calling the nsIAccelerationListener's, so that it only affects the orientation event and not the acceleration listeners.

Then using nsAccelerometer to generate orientation events might not be appropriate, as orientation and acceleration are not the same thing.

And since acceleration is what we have an implementation of, we might want to expose that instead of orientation.
@jesper - that is what simon fraser was suggestion on the whatwg list.  or more precisely, he was suggesting that the word "orientation" is already being used.
@olli - we only know what the accelerometer is reporting, and that is delayed a bit (because we need to throttle so that we do not overwhelm js).  Because of this delay, it does make sense to report the "current" position.

However, I do regret the fact that you can't see force.  having webapps monitor position changes might enable them to guestimate force.

I am open to suggestions here, but position might be best -- it is it consistent with the event's name "orientation".
If we start to report the force,
nsIDOMOrientationEvent.idl need to be renamed, and also the event
MozOrientation and nsGkAtoms::onMozOrientation.

I was doing some testing and removed the -1,1 limit.
On macbook I managed to get up to 1.9 values from the event when I rotated the
laptop very fast.

But if we want to keep/have the orientation, that should be within some limit,
like -1,1
Assignee: doug.turner → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.