Re: [screen-orientation] screen orientation angle

This all sounds reasonable; it's great that we'll be able to remove the
spec's artificial requirement that "if the device is in landscape-primary
and is rotated 90 degrees clockwise, that should be represented as

And it potentially opens the door to using a less error-prone selection of
keywords too.

On Tue, Nov 26, 2013 at 4:38 PM, Mounir Lamouri <> wrote:

> Hi,
> The Screen Orientation API defines an angle relationship between
> portrait-primary and landscape-primary. The reason for that is that
> developers would know which orientation is at 90 degrees from the
> current orientation, which one is at 180 degrees, etc. However, by
> forcing the two primary orientations to have a relationship, we prevent
> UA to do clever things like having landscape-primary being related to
> how the user uses his phone (eg. usually depending on which hand is
> used, the most common landscape is not going to be different).
> In addition, some use cases might need to know the angle between the
> current orientation and the native device orientation. For example, a
> compass using DeviceOrientation would need to know this angle to be able
> to draw the correct information on the screen [1].
> This is also a UC that Mozilla has with Firefox OS where some apps want
> to lock the orientation to the native device orientation (ie. angle=0)
> [2].
> So, the Screen Orientation API should allow locking to a specific
> orientation angle. For that, we could allow an integer to be passed to
> the lockOrientation() function, a modulo operation would be applied on
> the number to have it in the [0; 360[ range. If the UA is not able to
> lock to the specified angle, the method should fail (return false for
> the moment, the promise should fail in the future).
> The orientation angle should also be read. It would be possible to
> simply use window.orientation. I am not a big fan of that solution [3]
> but this is implemented by most Mobile UAs already so it might as well
> be the best thing to do. An alternative would be to have something like
> screen.orientationAngle or screen.orientation.angle (and
> [1]
> [2]
> [3] the value can be negative, which is a footgun and the having this
> value living in window and the rest in window.screen is odd
> --
> Mounir

Received on Tuesday, 26 November 2013 17:26:39 UTC