flambe icon indicating copy to clipboard operation
flambe copied to clipboard

Incorrect stage width and height on iPads when in Landscape WebView

Open accidentalrebel opened this issue 12 years ago • 4 comments

The stage width and height is incorrect when running HTML5 in landscape view in webview mode.

In portrait orientation it detects the correct sizes: 768x1024. But when the game is booted in landscape orientation it gets 1024x1024 when it should be 1024x768.

Also, it is important to note that there are no problems when the game is run inside Safari on iPad.

  • Only tested on iPads. Not sure if it happens on other devices

accidentalrebel avatar Feb 08 '13 02:02 accidentalrebel

Tested using the MiHTool. Bug still there.

accidentalrebel avatar Feb 27 '13 03:02 accidentalrebel

Just a heads up that I've confirmed this. It's not immediately obvious to me what the problem is though, please send a patch if you can!

aduros avatar Mar 04 '13 22:03 aduros

You could try using this idea: Change flambe.platform.html.HtmlStage.hx line 34: //scaleFactor = computeScaleFactor(); (Comment this out) scaleFactor = 1; (This fixes the high DPI resolution problems on iOS 4+ Retina.)

You'll have to manage the scale factor in your webpage.

grantbi avatar Jun 13 '13 21:06 grantbi

this may be relevant... http://stackoverflow.com/questions/2242086/how-to-detect-the-screen-resolution-with-javascript

when you rotate the device availHeight and availWidth don't actually change, so you may need to swap around the reported values if it's in landscape. (although i noticed you're not using availWidth/availHeight)

jmp909 avatar Nov 20 '13 13:11 jmp909