21 Sep 2012 8:03 AM #1
Incorrect sizing after orientation change
Sencha Touch version tested:
- only default ext-all.css
Platform tested against:
- iOS 5 (works fine)
- Android 2.x (not sure the version of the phone, but it worked fine)
- Android 4.0.4
- Android 4.1.1
- When rotating the device from landscape to portrait, while an overlay is present, the resulting layout will make everything look smaller.
- What is happening is, say that in landscape orientation the width and height of the browser is 1024x496(this is from the Galaxy Tab). Then after rotation, the width doesn't update correctly. The width remains 1024, and the height scales accordingly with the correct aspect ration of the device. So in this case the width and height are now 1024x1488. So the content is drawn for a screen size larger than what it was previously, resulting in everything looking smaller.
See this URL : http://dev.sencha.com/deploy/touch/e...ays/index.html
Steps to reproduce the problem:
This MUST be done on a mobile device. I have not been able to reproduce it in Chrome on a desktop. (tried resizing the window, doesn't have the same behavior)
- hold your device in a landscape orientation.
- press one of the "show" buttons
- rotate the device 90 degrees
The result that was expected:
- Items on the screen should appear to the same scale as they were before the orientation change
- everything looks tiny
landscape.jpgportrait buggy.jpgportrait normal.jpg
Debugging already done:
I have checked the values of some variables before and after changing the orientation of the device. The values I am showing here are from a Samsung Galaxy Tab.
Landscape Portrait Buggy Portrait Correct window.innerWidth 1024 1024 600 window.innerHeight 496 1488 920 window.outerWidth 1024 600 600 window.outerHeight 496 920 920 screen.width 1024 600 600 screen.height 600 1024 1024 screen.availWidth 1024 600 600 screen.availHeight 600 1024 1024 document.body.clientWidth 1024 1024 600 document.body.clientHeight 496 1488 920 document.body.offsetWidth 1024 1024 600 document.body.offsetHeight 496 1488 920
- not provided
21 Sep 2012 8:50 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
This blog may help you get around the orientation issue in ST1: http://moduscreate.com/orientation-c...e-android-bug/Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.