orientation does not update on iPad 3.2 with phonegap and sencha combined
I have already posted this on the Sencha Touch forum (http://www.sencha.com/forum/showthread.php?122865-OPEN-753-Bug-repo...) but they replied stating the problem originates from the Phonegap source, so I am posting it here - hoping you'll resolve the matter quickly.
When rotating the iPad with a sencha app compiled by Phonegap, the orientationchange is not working properly. The event is fired and handled, however the layout is not modified. When running the exact same code on the iPad Safari browser, everything works fine.
This is the test code I used:
Ext.namespace('nazgul');
var mainContainer; // globalised to ensure no problems with scope
for demo
nazgul.app = function(){
return {
init: function() {
var item = {
html: 'Page 2',
cls: 'card1'
}
mainContainer = new Ext.Panel({
fullscreen: true,
layout: 'card',
items: [item]
});
Ext.EventManager.onWindowResize(function(orientation, w, h){
//mainContainer.setOrientation( Ext.getOrientation() , window.innerWidth , window.innerHeight ); // if you activate this, the problem is fixed, however this is not an ideal solution
console.log(Ext.getOrientation());
mainContainer.doLayout();
});
mainContainer.on('afterLayout',function(){
console.log('layout changed')}
);
}
};
}();
runPhoneGap(function() {
Ext.setup({
onReady: nazgul.app.init
});
});
The runPhoneGap() function does the following:
var runPhoneGap = function(initializationFunction) {
if (document.readyState == 'loaded' || document.readyState ==
'complete') {
initializationFunction();
} else {
if (navigator.userAgent.indexOf('Browzr') > -1) {
setTimeout(initializationFunction, 250)
} else {
document.addEventListener('deviceready', initializationFunction, false);
}
}
};
Some additional annoying side effects of this bug:
When using animations and rotating, things go very wrong - but only
if you booted the application in portrait mode, when booting in
landscape mode it works fine.
The problem is that the animation gets moved 50% (ish) up the
screen when rotating from portrait to landscape. I could post a
video if this helps.
That's tested on a device with iOS 4.2. On the Simulator with 3.2
nothing works... at all
And when porting the app to MVC following sencha's instructions to the letter, nothing resizes anymore.
Help would be greatly appreciated as this will most probably be a commercial product we will launch, depending on how development goes with Sencha+Phonegap, otherwise we'll have to revert back to Titanium.
Discussions are closed to public comments.
If you need help with Lighthouse please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
1 Posted by Nicole on 05 Feb, 2011 09:12 PM
This is the support forum for Lighthouse. I believe you've submitted this to us by mistake.
Thanks,
Nicole
Nicole closed this discussion on 05 Feb, 2011 09:12 PM.