Results 1 to 6 of 6

Thread: orientationchange event sends wrong height/width on Android stock browser

    You found a bug! We've classified it as TOUCH-5783 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    443
    Vote Rating
    18
      0  

    Default orientationchange event sends wrong height/width on Android stock browser

    Android 4.1.2 emulator, 400x800 screen, Sencha Touch 2.4.2.

    Create a page with the following code:
    Code:
    Ext.Viewport.on('orientationchange', function(viewport, orientation, width, height) {
        console.log("orientationchange handler: " + orientation + " " + width + " " + height);
    });
    Launch in stock browser, in portrait mode. Rotate to landscape. Result is width=320, height=456. This was the width/height in portrait, before the rotation.

    Rotate to portrait. Result is width=533, height=291. This was the width/height in landscape, before the rotation.

    It's always sending the wrong width/height.

    I think this has something to do with the use of the 'orientationchange' event in ST 2.4.2, whereas 'resize' was used before (although that didn't work either, for different reasons.)

    If I set Ext.feature.has.OrientationChange to false before the Ext.viewport.Default constructor is called, it uses the 'resize' event instead, and this makes it return the right width/height values (although I don't know what else might break).

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Vote Rating
    1368
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    85
    Vote Rating
    2
      0  

    Default

    I'm having the same problem. Any news about it? The solution I used at version 2.3.1 does not work anymore.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default

    We have the same issue here and it causes big problems for our application on the latest Nexus 9 on Android 5.1.1.

    We can see from debugging the code that the orientationchange event is occurring before the screen size has changed. We are considering overriding this detection to defer the orientation check for a few milliseconds, but this is not ideal.

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Posts
    85
    Vote Rating
    2
      0  

    Default

    For me using resize event instead of orientationChange resolved my issue

  6. #6
    Sencha User
    Join Date
    Jan 2009
    Posts
    39
    Vote Rating
    0
      0  

    Default

    True, use the resize event

Similar Threads

  1. Android 4.1 is using Stock browser or Chrome when using with Phonegap ?
    By debianw in forum Sencha Touch 2.x: Discussion
    Replies: 1
    Last Post: 16 Feb 2013, 2:13 PM
  2. [FIXED] Pinch event throws errors in stock Android browser
    By jbrantly@assuresign.com in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 8 Oct 2012, 12:35 PM
  3. Replies: 2
    Last Post: 5 Oct 2012, 4:20 AM
  4. [FIXED] Android orientationchange Event Not Firing
    By hallbox in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 14 Jun 2012, 2:04 PM
  5. Sencha Touch App in UIWebView - wrong dimensions on 'orientationchange' event
    By Ion Tichy in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 25 Apr 2011, 7:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •