[TIMOB-19558] Ti.Gesture: orientationchange event reports incorrect orientation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 4.1.0, Release 4.1.1, Release 5.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | andoid, android-4.0, orientation, orientationChange, titanbeta |
Reporter | Shawn Lipscomb |
Assignee | Frankie Merzadyan |
Created | 2015-09-21T16:34:17.000+0000 |
Updated | 2017-03-27T16:07:29.000+0000 |
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+')';
}
Is this a regression?
Yes, it is a regression. Works fine in Ti SDK 3.5.1.
Happy to see that this has finally been assigned to someone.