Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19558

Ti.Gesture: orientationchange event reports incorrect orientation

    Details

      Description

      The Ti.Gesture orientationchange event reports incorrect orientation. Run the following code, holding the device in portrail orientation, and it will report Landscape Left. Rotate the device, and the reported orientation will always be 90 degrees off.

      Ti.UI.setBackgroundColor('#000');
       
      // Ti.UI.PORTRAIT=1
      // Ti.UI.LANDSCAPE_LEFT=2
      // Ti.UI.UPSIDE_PORTRAIT=3
      // Ti.UI.LANDSCAPE_RIGHT=4
       
      var OrientationNames=[ 'Unknown', 'Portrait', 'Landscape Left', 'Upside Down Portrait', 'Landscape Right' ];
       
      var win1=Ti.UI.createWindow({
                 exitOnClose:true,
                 navBarHidden:false,
                 backgroundColor:'#fff',
                 layout:'vertical'
               });
       
      var OrigOri=Ti.Gesture.orientation;
      var label1=Ti.UI.createLabel({
                   color:'#999',
                   text:'Original Orientation: '+OrientationNames[OrigOri]+' ('+OrigOri+')',
                   font:{fontSize:20,fontFamily:'Helvetica Neue'},
                   textAlign:'center',
                   top:'25%',
                   width:'auto'
                 });
      var label2=Ti.UI.createLabel({
                   color:'#999',
                   text:'Current Orientation: '+OrientationNames[OrigOri]+' ('+OrigOri+')',
                   font:{fontSize:20,fontFamily:'Helvetica Neue'},
                   textAlign:'center',
                   top:'25%',
                   width:'auto'
                 });
       
      win1.add(label1);
      win1.add(label2);
      win1.open();
       
      Ti.Gesture.addEventListener('orientationchange',TestOrientationChange);
      function TestOrientationChange(evt)
      {
        var CurrOri=evt.orientation;
        label2.text='Current Orientation: '+OrientationNames[CurrOri]+' ('+CurrOri+')';
      }
      

        Attachments

          Activity

            People

            • Assignee:
              fmerzadyan Frankie Merzadyan (Inactive)
              Reporter:
              bitshftr Shawn Lipscomb
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20383
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code