Home › Forums › Programming › Resize not as expected
Tagged: resize scene
I’m trying to resize the canvas element and then want to have the current scene centered automatically.
Using app.onResize() it’s working if the browser window is resized manually.
But if I resize just the parent container(div) of the canvas then the event is always one step behind.
I tried several things, but not successfully. So now I’m out of ideas.
What I tried:
Version of my verge3d is 3.9.1. I tried also js file from the current 4.1. but that didn’t change anything.
Maybe one of you guys have another tipp, approach, whatever.
Works as expected
Could now solve my issue by calling app.onResize() after 200ms using timeout.
For some reasons the app wasn’t able to get the correct width without using the timeout.
The solution is a little bit ugly but ok for now.
But thanks for the hint.
In fact, it doesn’t matter. Show your code that reacts on the container resizing.
Test your math:
Log in / Register