Re: [screen-orient] Updated editor draft

On Mon, Nov 5, 2012 at 9:19 AM, Lars Knudsen <larsgk@gmail.com> wrote:
> Why not use the existing definitions in the orientation change event?
>
> http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW16
>
> simple "landscape" and "portrait" can always be deducted from the values -
> but you have more precise info.  This is also possible to map to/from
> accelerometer data if needed.
>
> (speaking as a web demos/apps/games developer).
>
> code quote:
>
> switch(window.orientation)
>                 {
>                     case 0:
>                         displayStr += "Portrait";
>                     break;
>
>                     case -90:
>                         displayStr += "Landscape (right, screen turned
> clockwise)";
>                     break;
>
>                     case 90:
>                         displayStr += "Landscape (left, screen turned
> counterclockwise)";
>                     break;
>
>                     case 180:
>                         displayStr += "Portrait (upside-down portrait)";
>                     break;
>
>                 }


This is only true on devices whose "main orientation" is portrait
mode. At least on some devices which have the normal mode of operation
being in landscape mode, the above returns flipped values.

/ Jonas

Received on Monday, 5 November 2012 22:38:07 UTC