1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    396
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default How to determine current screen orientation

    How to determine current screen orientation


    Hi,

    How can I determine on an ad-hoc basis what the screen orientation is of the device being used?

    I know I can listen for the orientation change event on the viewport, but what about when the user first loads up the application, how can I determine this through code?

    Thanks

  2. #2
    Sencha User dobie_'s Avatar
    Join Date
    Sep 2011
    Location
    Seattle, WA
    Posts
    47
    Vote Rating
    0
    dobie_ is on a distinguished road

      0  

    Default


    I would look at window.innerWidth and window.innerHeight and infer the orientation from there.

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2009
    Posts
    239
    Vote Rating
    2
    stephen.friedrich will become famous soon enough

      0  

    Default


    Yeah, that's strange to have an event to tell about value changes, but no way to get the current value.

    You could call
    Ext.Viewport.determineOrientation()
    which returns "portrait" or "landscape" but that method is not documented to be public.

    You could also look at the code (in viewport/Default.js) and copy it, or request that the method is made public.
    ExtJS 4 plugins:
    varheaders - short/normal/long column header
    clearbutton - mouseover clear button in text field
    Blog: fit4dev
    ExtJS User Group Hamburg

  4. #4
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Code:
    Ext.Viewport.getOrientation();
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."