mysistinechapel Posted August 7, 2014 Share Posted August 7, 2014 I have been playing around with panda.js the last couple days and I have a question: Is there a way to keep it at portrait orientation even after moving a mobile device sideways where it would switch to landscape orientation? By default, if it is set for portrait orientation and the device is moved sideways, the screen will white. If properties are set in config, we can display a message telling the user to move back to portrait. However... what I am interested in is keeping the game at portrait regardless of how the mobile device is moved. Is there a way to configure this using panda.js? Quote Link to comment Share on other sites More sharing options...
enpu Posted August 8, 2014 Share Posted August 8, 2014 Hey, this feature will be available on 1.8 version. You can test it already on develop branch:https://github.com/ekelokorpi/panda.js/tree/develop Config example:pandaConfig = { system: { width: 768, height: 1024, rotateScreen: false }};Let me know, if that works for you! Quote Link to comment Share on other sites More sharing options...
antbrooksuk Posted August 8, 2014 Share Posted August 8, 2014 if("lockOrientation" in window.screen) { window.screen.lockOrientation("landscape"); } Quote Link to comment Share on other sites More sharing options...
mysistinechapel Posted September 19, 2014 Author Share Posted September 19, 2014 Epnu - I would like to keep the user in portrait mode even they turn their device sideways. Using the rotateScreen: false property value in config.js allows for the game to change back and forth from landscape to portrait depending on how the user turns their device. Is there a way in pandajs to to keep the app at a specified orientation? antbrooksuk - I'm not sure where I would put that code snippet when using pandajs. Any ideas would be great. Quote Link to comment Share on other sites More sharing options...
enpu Posted September 19, 2014 Share Posted September 19, 2014 @mysistinechapel afaik, there is no way to lock screen orientation on mobile browser (yet), only when using wrapper like CocoonJS Quote Link to comment Share on other sites More sharing options...
Sebi Posted September 19, 2014 Share Posted September 19, 2014 What you can do is to rotate the screen on orientation change. e.g.:landscape 480 width 320 height,on portrait -> resize to 320 width and 480 height, rotate the stage by 90 degree (or -90 degree, depending on orientation) Then all you need to account for is that e.pageX become e.pageY and e.pageY becomes height - e.pageX Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.