Issue description
When you position an element with the property "right" and any value assigned, then you change the orientation to, either portrait or landscape the property "right" value is not correctly updated.
None of these issues existed before the upgrade to Titanium SDK 3.2.3.GA, and all of them are fixed if the SDK version is reverted to 3.2.2.GA with no other code changes.
Steps to replicate
The sideBar View is experiencing the following issues:
Starting in portrait, press 'Expand' to expand the side bar, then change orientation to landscape. Side bar is now stuck in the middle of the window (please see screen shoots attached demonstrating misplaced sideBar at 3.2.3.GA).
Starting in portrait, press 'Expand' and then 'Collapse' to collapse the side bar, then change orientation to landscape. The side bar is now visible again.
Starting in landscape, press 'Expand' and then reorient to portrait. The side bar is now off-screen (20% is shifted to the left).
Runnable Sample
var win = Ti.UI.createWindow({
navBarHidden : true,
backgroundColor : '#00f',
width : Ti.UI.FILL,
height : Ti.UI.FILL
});
var toggle = Ti.UI.createButton({
top : 100,
left : 10,
title : 'Expand'
});
toggle.addEventListener('click', toggleSideBar);
win.add(toggle);
var sideBar = Ti.UI.createView({
top : 0,
right : -300,
width : 300,
height : Ti.UI.FILL,
backgroundColor : 'pink',
expanded : false
});
function toggleSideBar(e) {
if (sideBar.expanded) {
sideBar.animate({
right : -300,
duration : 400
}, function() {
sideBar.right = -300;
sideBar.expanded = false;
toggle.title = 'Expand';
});
} else {
sideBar.animate({
right : 0,
duration : 400
}, function() {
sideBar.right = 0;
sideBar.expanded = true;
toggle.title = 'Collapse';
});
}
}
Ti.Gesture.addEventListener('orientationchange', function(e) {
Ti.API.info(' #### OrientationChange sideBar.right: ' + sideBar.right);
if (e.source.isLandscape() && sideBar.expanded) {
sideBar.right = 0;
} else if (e.source.isPortrait() && !sideBar.expanded) {
sideBar.right = -300;
}
});
win.add(sideBar);
win.open();
Tested and this is working fine on lastest master. Resolving issue as unable to reproduce.
Closing ticket as the issue cannot be reproduced.