Re: [screen-orientation] screen orientation angle

On Tue, Nov 26, 2013 at 8:38 AM, 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).

Good point. Simply dropping the requirement that there's any
relationship between the primary orientations seems fine.

We can leave a non-normative note that encourages a particular
relationship if there are no other reasons to use any other
relationships. But I'm fine with leaving that out too.

> 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).

I could see use cases for allowing angle=0. I've found that there are
often benefits to holding the device in it's "normal" orientation has
benefits, such as that the hardware buttons like home/power/volume are
where I expect them to be.

So I could see apps wanting to lock to that orientation (like you
pointed out, we found at least one example in Firefox OS).

However I don't understand the use case of locking to 90/180/270
degrees off of the "normal" orientation?

Simply adding a "default" (or "hardware" or "normal") orientation seem
to keep the API more consistent.

I'd also be worried about introducing the same issues as
window.orientation has. I.e. that people would come to expect that
lockOrientation(90) would mean "lock to landscape".

/ Jonas

Received on Tuesday, 3 December 2013 05:14:05 UTC