On Android, Ti.Gesture.orientation is returning different values than e.orientation, and neither are differentiating landscape left and right.
The following code reports the different orientation values. Run it on iOS, and you will see the Ti.Gesture.orientation is in sync with the evt.orientation. But run it on Android, and you will see they differ.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var lblOrientation = Ti.UI.createLabel({
color: '#999',
text: 'Ti.Gesture.orientation',
font: { fontSize: 20, fontFamily: 'Helvetica Neue' },
textAlign: 'center',
width: 'auto', height: 'auto',
top: 20
});
win.add(lblOrientation);
var lblEvtOrientation = Ti.UI.createLabel({
color: '#999',
text: 'e.orientation',
font: { fontSize: 20, fontFamily: 'Helvetica Neue' },
textAlign: 'center',
width: 'auto', height: 'auto',
top: 50
});
win.add(lblEvtOrientation);
var lblIsPortrait = Ti.UI.createLabel({
color: '#999',
text: 'isPortrait',
font: { fontSize: 20, fontFamily: 'Helvetica Neue' },
textAlign: 'center',
width: 'auto',
height: 'auto',
top: 80
});
win.add(lblIsPortrait);
var lblIsLandscape = Ti.UI.createLabel({
color: '#999',
text: 'isLandscape',
font: { fontSize: 20, fontFamily: 'Helvetica Neue' },
textAlign: 'center',
width: 'auto', height: 'auto',
top: 110
});
win.add(lblIsLandscape);
Ti.Gesture.addEventListener('orientationchange', function(evt) {
lblOrientation.text = Ti.Gesture.orientation;
lblEvtOrientation.text = evt.orientation;
lblIsPortrait.text = evt.source.isPortrait();
lblIsLandscape.text = evt.source.isLandscape();
});
win.open();
I think this only half duplicates [TIMOB-1294]. You bring up two bugs: 1. e.orientation should equal Ti.Gesture.orientation. This duplicates [TIMOB-1294]. 2. The orientations are incorrect for left and right landscape; they should be consistent between iOS and Android. So this ticket could be repurposed for the 2nd issue you brought up, and the 1st can be removed. You could provide more details and sample code on [TIMOB-1294] to help it on its way, too.
Just to be clear: On Android * e.orientation reports the same value whether phone is landscape left or right * Ti.Gesture.orientation is also the same whether left or right * But e.orientation != Ti.Gesture.orientation regardless of phone's orientation On iOS * e.orientation reports the different values when phone is landscape left or right * Ti.Gesture.orientation is also reports different when left or right * And e.orientation == Ti.Gesture.orientation iOS appears to be working correctly and as I'd expect. I've provided info on it just as a contrast to what's happening on Android.
Tim Being an employee, you should have write access to the main projects. Can you confirm this, please? Thus, you should be able to move this ticket yourself to the correct project. Thanks
Paul, I can create issues under two projects: Aptana Studio and Titanium Community.
Tim, OK, my apologies - it isn't actually available to *all* employees but, rather, some departments.
I was not able to reproduce this bug in master. I will be filing a separate bug for apidocs regarding what ti.gesture.orientation returns.
Yes, this seems to have been fixed in the 1.8 series as I can't reproduce the problem any more either.