Hi guys,
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.
- reduce size of parent container nothing happens
- enlarge size of parent container canvas shrinks
- reduce size of parent container canvas enlarges
Expected behaviour:
- reduce size of parent container canvas shrinks
- enlarge size of parent container canvas enlarges
- reduce size of parent container canvas shrinks
I tried several things, but not successfully. So now I’m out of ideas.
What I tried:
- trigger resize event on window or on parent element
- tried to call onResize() several times
- tried to resize container in steps
- change also the size of the canvas.
This squeezed the scene. And calling app.onResize() revert the resize of the canvas. Probably because it is taken the size from the window.
- setting the current camera again
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.
Kind regards,
Michael