display.contentWidth Bug?!

I’m not too sure if it’s just me but I think there is a bug with display.contentWidth. I am on a Mac platform using the latest daily build.

This is how to reproduce it:

  1. Create a new blank app for iPad

  2. Edit the build.settings file to support more orientations:

supported = { "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown" },
  1. Add the following line of code to main.lua
local test = display.newText( display.contentWidth, display.contentWidth/2, display.contentHeight/2, "Helvetica", 18 )
  1. Build the app and copy to iPad

  2. Turn on the iPad in portrait mode then rotate to (any) landscape mode.

  3. Now this is the trick here, while still maintaining landscape mode, place the iPad flat on the table and start the app! It shows 768

  4. Next, kill the app, lift up the iPad so that it is more vertical, run the app again! Now shows 1024! Is it just me? :o

Could anyone else please help confirm this? This is preventing me from shipping.

Thank you very much,
Simon [import]uid: 56623 topic_id: 25487 reply_id: 325487[/import]

Hey Simon,

That sounds a little strange; would you be able to file a bug report and include a test project we can use to reproduce the issue, please? (I know it’s only a few lines but including a project we can just run makes things much easier for us.)

If you could do that someone will be able to check it out for you.

Peach :slight_smile: [import]uid: 52491 topic_id: 25487 reply_id: 103042[/import]

Thanks again for the reply Peach! : )

Have just opened a ticket (13795) in FogBugz.

Have a good day. [import]uid: 56623 topic_id: 25487 reply_id: 103051[/import]

Thanks Simon,

Hopefully someone will be able to check it out shortly.

You have a good day too :slight_smile:

Peach [import]uid: 52491 topic_id: 25487 reply_id: 103235[/import]

Hi Peach,

I’ve gone ahead and submitted the buggy version of my app. My case is still incoming/pending review. Do you know what’s the average time before submitted bugs get reviewed?

Thank you,
Simon [import]uid: 56623 topic_id: 25487 reply_id: 104431[/import]

By the way, it seems as if display.contentWidth may be obtained by reading accelerometer values and if the iPad is flat, it assumes it’s in (rightside up) portrait mode?

Simon [import]uid: 56623 topic_id: 25487 reply_id: 104432[/import]

The time depends on the severity of the bug though most get looked at and assigned to someone within a day or two I believe. It’s a process though, the bug has to be confirmed (which is why we have you send working samples we can test, to save time) and then it can be reassigned depending on where the issue lies.

I am afraid I don’t know off hand how these values are read or what is assumed when it is flat, I support portrait would make sense to assume in that case as it is the “default” orientation, though. [import]uid: 52491 topic_id: 25487 reply_id: 104591[/import]

I had a similar problem and solved it (I think) by hardcoding my variables. So instead of something like : _W=display.contentWidth
I did: _W=320 at the top of each page and it has fixed things for now, and I will be able to change it back easily in the future.
I still need to build for device to make sure it’s fixed.
This problem seems to be happening when I start my app in landscape mode for at least the first two seconds on the iPad. It also happens in the simulator if I set my default setting to landscapeLeft or landscapeRight. It goes away when I restart the app in portrait mode. Good luck!
[import]uid: 57883 topic_id: 25487 reply_id: 104794[/import]

Thanks madfamfun, I will try changing my default settings but unfortunately I can’t hardcode as I am supporting both orientations in my app.

Thanks,
Simon [import]uid: 56623 topic_id: 25487 reply_id: 105163[/import]

@simon, i personally tested your case and it does appear to be a bug, it has been passed on to our engineering team to investigate/fix.

I can’t give you a specific eta on the fix but I just wanted to inform you that we know about it. [import]uid: 84637 topic_id: 25487 reply_id: 106087[/import]

Thanks for testing and confirming it Danny! :slight_smile: Have a great weekend. [import]uid: 56623 topic_id: 25487 reply_id: 106151[/import]