Orientation change issues

We found a strange behaviour regarding orientation changes (build 2012.906).

Corona seems to change the screen’s width and height (as reported by display.contentWidth and display.contentHeight) with EVERY orientation change -even if the new orientation is NOT allowed in the build.settings file. There is also an orientation event fired where event.type is set to the new orientation -also if this orientation is NOT allowed in the build.settings file.

However, if the current orientation is NOT allowed by the build.settings file, the screen matrix is NOT rotated, therefore Corona reports a wrong screen size and a wrong orientation mode then.

This happens on Window, Mac, as well as on the device.

EXAMPLE:
Our app starts in Landscape mode, width and height are 480x320. The only supported orientation modes in the build.settings file are “landscapeLeft” and “landscapeRight”.

If the device is now rotated to portrait mode, Corona fires an orientation event with event.name = “portrait” and display.contentWidth and display.contentHeight report a width of 320 and a height of 480 (portrait mode) -the actual screen matrix, however, is NOT rotated to reflect this!!

If the current orientation is not allowed in the build.settings file (and therefore the device screen matrix itself was not rotated), the screens display.contentWidth and display.contentHeight shouldn’t be changed and event.type should not report any orientation types that are not supported by the build.settings file.

[import]uid: 10504 topic_id: 31882 reply_id: 331882[/import]

Just tested build 934 which still has the same issue.

Again, after an orientation change occured, Corona reports the new orientation’s name, new width and height AS IF the orientation was actually changed, even when it is NOT changed because the new orientation is not supported by the build.settings file and therefore the screen matrix is not rotated. This lets an app think the screen was actually rotated, also when it is NOT.
[import]uid: 10504 topic_id: 31882 reply_id: 127209[/import]

Just tested build 934 which still has the same issue.

Again, after an orientation change occured, Corona reports the new orientation’s name, new width and height AS IF the orientation was actually changed, even when it is NOT changed because the new orientation is not supported by the build.settings file and therefore the screen matrix is not rotated. This lets an app think the screen was actually rotated, also when it is NOT.
[import]uid: 10504 topic_id: 31882 reply_id: 127209[/import]

Just tested your bug using build 935 on iPhone device running iOS 5.1 and iOS 6.0 and don’t see the problem. Here is what I get from the Xcode console.

CURRENT ORIENTATION MODE: portrait  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
!!! THIS SCREEN MODE IS NOT ALLOWED BY BUILD.SETTINGS FILE !!!  
CURRENT ORIENTATION MODE: landscapeLeft  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
CURRENT ORIENTATION MODE: portrait  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
!!! THIS SCREEN MODE IS NOT ALLOWED BY BUILD.SETTINGS FILE !!!  
CURRENT ORIENTATION MODE: landscapeRight  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
CURRENT ORIENTATION MODE: faceUp  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  

There is a known bug in the simulator where it will swap the height and width when rotated to a non-supported orientation but it works correctly on devices.

Update: The Orientation event will occur for orientations not specified in the build.settings file. This allows you to manage the orientation and rotation of your app without the OS getting involved. The Fishies sample app demonstrates this. This is not a bug in Corona. [import]uid: 7559 topic_id: 31882 reply_id: 127763[/import]

Just tested your bug using build 935 on iPhone device running iOS 5.1 and iOS 6.0 and don’t see the problem. Here is what I get from the Xcode console.

CURRENT ORIENTATION MODE: portrait  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
!!! THIS SCREEN MODE IS NOT ALLOWED BY BUILD.SETTINGS FILE !!!  
CURRENT ORIENTATION MODE: landscapeLeft  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
CURRENT ORIENTATION MODE: portrait  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
!!! THIS SCREEN MODE IS NOT ALLOWED BY BUILD.SETTINGS FILE !!!  
CURRENT ORIENTATION MODE: landscapeRight  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  
CURRENT ORIENTATION MODE: faceUp  
CURRENT SCREEN WIDTH: 480 SCREEN HEIGHT: 320  

There is a known bug in the simulator where it will swap the height and width when rotated to a non-supported orientation but it works correctly on devices.

Update: The Orientation event will occur for orientations not specified in the build.settings file. This allows you to manage the orientation and rotation of your app without the OS getting involved. The Fishies sample app demonstrates this. This is not a bug in Corona. [import]uid: 7559 topic_id: 31882 reply_id: 127763[/import]