Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: New version Sencha Touch 2.3 - Orientationchange event does not fire on Viewport

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4978 in 2.4.2.
  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    12
    Vote Rating
    2
      2  

    Default New version Sencha Touch 2.3 - Orientationchange event does not fire on Viewport

    REQUIRED INFORMATIONExt version tested:
    • Sencha Touch 2.3.0
    Browser versions tested against:
    • Default Internet Browser on Android Mobile 4.1.2
    Description:
    • On the new version of Sencha Touch (2.3.0) orientationchange event does not fire anymore. On the previous version of Sencha Touch 2.2.1 was working for sure.
    Steps to reproduce the problem:
    • A simple example which is rendering a panel into Ext.Viewport. After this I add a listener to orientationchange event, where I just display an alert message
    The result that was expected:
    • The display of the alert message "orientation change" when the user change orientation view to "landscape" or "portrait"
    The result that occurs instead:
    • The alert message is not displayed, which means the "orientationchange" event is not fired
    Test Case:
    Code:
       Ext.application({   
        requires: [
            'Ext.MessageBox',
            'Ext.data.Store',
            'Ext.List',
            'Ext.plugin.PullRefresh'
        ],
        launch: function() {
    
    
           Ext.Viewport.add({
                xtype:'panel',
                html:'my test'
           });
            
           Ext.Viewport.on('orientationchange', function() {
        		alert('orientation change');
    		});
        }
    });

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,107
    Vote Rating
    136
      0  

    Default

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

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    62
    Vote Rating
    1
      0  

    Default

    Any workaround?

    This doesn't work too:
    Code:
    Ext.device.Orientation.on({    
        scope: this,
        orientationchange: function(e) {
            console.log('Alpha: ', e.alpha);
            console.log('Beta: ', e.beta);
            console.log('Gamma: ', e.gamma);
        }
    });

  4. #4
    Sencha User th3nu11's Avatar
    Join Date
    Apr 2013
    Posts
    36
    Vote Rating
    1
      0  

    Default news???

    are there news about this bug?? I need this functionality!

  5. #5
    Sencha User
    Join Date
    May 2011
    Location
    Melbourne, Australia
    Posts
    89
    Vote Rating
    7
      0  

    Default

    Workaround?:

    Code:
    Ext.Viewport.on({    
        scope: this,
        widthchange: function() {
            if (Ext.Viewport.element.getWidth() > Ext.Viewport.element.getHeight()) {
                // fire event or apply handlers for orientation change: landscape
            } else {
                // fire event or apply handlers for orientation change: portrait
            }
        }
    });

  6. #6
    Sencha User th3nu11's Avatar
    Join Date
    Apr 2013
    Posts
    36
    Vote Rating
    1
      0  

    Default

    no, not works: this event is never start!

  7. #7
    Sencha User th3nu11's Avatar
    Join Date
    Apr 2013
    Posts
    36
    Vote Rating
    1
      0  

    Default

    Ok, I found a workaround!

    Adding this subscription

    Ext.Viewport.bodyElement.on('resize', function(){
    //empty
    }, this, { buffer: 1});

    on initialize of my main view, magically,
    Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 50 });

    works!


    (android apk)

  8. #8
    Sencha User
    Join Date
    Sep 2012
    Posts
    104
    Vote Rating
    0
      0  

    Default

    Hi @th3nu11,

    Thanks for your workaround!

    Adding
    Code:
    Ext.Viewport.bodyElement.on('resize', Ext.emptyFn, this, { buffer: 1});
    to the app's launch() function solved the issue for me.

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Posts
    445
    Vote Rating
    19
      0  

    Default

    This still isn't fixed in 2.3.1. Seems like a major issue...

  10. #10
    Sencha User kekiel's Avatar
    Join Date
    May 2013
    Location
    Germany
    Posts
    2
    Vote Rating
    0
      0  

    Default Fix it, please

    Hi!
    Definetly a bug. Using x-portrait / x-landscape CSS classes to adopt layout did not work in android.
    Thanks a lot for the workaround. Works perfect! (in 2.3.1, using cordova)

Page 1 of 3 123 LastLast

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
  •