Re: [screen-orientation] screen orientation angle

I am OK with this. When discussing with John Mellor, we also concluded
that screen.orientationAngle was useful, due to the exact same
reasons. Allowing lockOrientation to take either a string (with simple
to use defaults) and take an angle for the more advanced use-cases,
sounds like a pretty good compromise.

Some questions:

a) Will this be a delta from the current orientation? or relative to
the default device orientation? I guess the former makes the most
sense.
b) What should happen if the device is already busy changing
orientation when the request is done? I think failing might make the
most sense.

When we are moving to promises I would rename it to
requestOrientationLock though as it fits more inline with other APIs.

Kenneth


On Tue, Nov 26, 2013 at 5:38 PM, Mounir Lamouri <mounir@lamouri.fr> 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
> screen.orientation.name).
>
> WDYT?
>
> [1] http://oldworld.fr/google/compass.html
> [2] https://bugzilla.mozilla.org/show_bug.cgi?id=908058
> [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
>



-- 
Kenneth Rohde Christiansen
Web Platform Architect, Intel Corporation.
Phone  +45 4294 9458 ﹆﹆﹆

Received on Tuesday, 26 November 2013 16:50:28 UTC