Is it possible to change webView width during orientation handling?

My app is in portrait mode showing a webView, and now I try to handle orientation. Therefore, in my orientation handler (from portrait --> landscapeRight, for example), I try to rotate the webView & change the width to fill the width of the screen like this:

webView.rotation = 90 webView.x = newX webView.y = newY webView.width = newWidth -- the width of landscape screen

The webView does rotate correctly. If I don’t change its width, the webView is positioned correctly at (newX, newY)

But if I try to change its width (the 4th line, webView.width = newWidth), there are two problems:

(1) The webView is not positioned correctly (seems positioned in the middle)

(2) The webView width does not change. And the web page in the webView seems getting “zoomed” instead.

Please help. How to change webView width correctly in order to handle orientation changes?

P.S. The behaviors shown above are tested with iPhone 5S. Simulator behaves differently. 

I created a simple project to isolate problems. Here is the complete code in main.lua (320x480, letterbox in config.lua, only Portrait mode is supported)

local webView = native.newWebView(0, 0, 320, 480) webView.x = display.contentWidth \* 0.5 webView.y = display.contentHeight \* 0.5 webView:request("http://www.coronalabs.com") local function rotateWebView() print("rotateWebView") webView.rotation = 90 webView.width = 480 webView.height = 320 end timer.performWithDelay(3000, function() rotateWebView() end)

And the result screenshot is attached. Please take a look. (Not only width/height is not set right. The web content is totally "weird)

Is this a bug or am I doing something wrong?

The above has to be tested in actual devices. For example, I tested it with iPhone 5S.

Simulator behaves differently. Please ignore Simulator.

Any thoughts or comment?

This problem is quite urgent because it’s a basic requirement to implement webView to support device orientation.

I have filed a bug report, Case 30097

Hope Corona can act on it asap. Thanks.

@Corona

Any plan or input about this bug?

When it comes to this bug, it’s always like I am talking to myself (scroll up and see the avatars).

If you’ve filed a bug report, then the QA department will go through the bug reports, verify them,  prioritize them and schedule engineering to work on it.  From what I can see it’s still in being researched.

Rob

Thanks for your reply, I really hope this can be fixed at your earliest convenience.

Most of my user complaints are all about this right now.

Besides, I will be really quiet about webView after this fix… hopefully.

I created a simple project to isolate problems. Here is the complete code in main.lua (320x480, letterbox in config.lua, only Portrait mode is supported)

local webView = native.newWebView(0, 0, 320, 480) webView.x = display.contentWidth \* 0.5 webView.y = display.contentHeight \* 0.5 webView:request("http://www.coronalabs.com") local function rotateWebView() print("rotateWebView") webView.rotation = 90 webView.width = 480 webView.height = 320 end timer.performWithDelay(3000, function() rotateWebView() end)

And the result screenshot is attached. Please take a look. (Not only width/height is not set right. The web content is totally "weird)

Is this a bug or am I doing something wrong?

The above has to be tested in actual devices. For example, I tested it with iPhone 5S.

Simulator behaves differently. Please ignore Simulator.

Any thoughts or comment?

This problem is quite urgent because it’s a basic requirement to implement webView to support device orientation.

I have filed a bug report, Case 30097

Hope Corona can act on it asap. Thanks.

I spent two hours yesterday trying to “tune” the positions after the webView is rotated.

I thought I could fine tune but finally I gave up. It’s really a bug.

(1) For Simulator, I could tune the positions so that webView can be rotated and put correctly in the screen. (but the algorithm is quite odd)

(2) I thought I could do the same for the device.

(3) Actual devices (I tested with iPhone 5S & iPad 3) behaves differently than Simulator after webView rotates. The webView in actual devices gets really funky when changing its width/height after changing its rotation property.

(4) Even without any orientation or rotation, simply changing webView width/height is screwing the webView content. (The content is stretched)

CONCLUSION

The conclusion is that current webView cannot support device orientation at all, no matter how.

I really hope this can be addressed as soon as possible. 

For a business app that supports orientation + webView, it’s a common practice but it’s not achievable via Corona right now.

@Corona

Please give me some hint if you are going to fix this problem or not, and probably how long?

I am seriously planning to discontinue my current business app or trying to get it to a next level.

This problem (bug) is really holding me back. This problem is very FUNDAMENTAL if an app with webView wants to support orientation!

I don’t know what to do next.

Please at least let me know if you are not going to fix it for a long time, then I will just discard the plan and move on to something else!

@joe528, I will bring this up to the engineers. 

Rob

Consider this:

( a ) a business app with web browser   <----- common

( b ) a business app that supports orientation    <----- common

Now, a business app with web browser that supports orientation cannot be achieved by Corona SDK

I think this should be escalated to product managers to decide if this problem should be addressed or not (and when)

@Corona

Any plan or input about this bug?

When it comes to this bug, it’s always like I am talking to myself (scroll up and see the avatars).

If you’ve filed a bug report, then the QA department will go through the bug reports, verify them,  prioritize them and schedule engineering to work on it.  From what I can see it’s still in being researched.

Rob

Thanks for your reply, I really hope this can be fixed at your earliest convenience.

Most of my user complaints are all about this right now.

Besides, I will be really quiet about webView after this fix… hopefully.

still waiting eagerly & deperately to know