Loaded model shrinks and expands

I apologize in advance for not having a playground available. I tried to reproduce the issue in the playground but was unable to.

I have this project that uses DevExpress web controls. A splitter control that divides up the screen into 4 collapsing/expanding sections. The middle section is where the canvas resides. The two side sections have some mesh manipulation tools and the top section is a menu with some buttons. Expanding the two side sections appear to make the model shrink


and vice versa.

I thought that

window.addEventListener("resize", function () {
    engine.resize();
});

would take care of it but it doesn’t appear to. Actually I think I understand why. Is it because it is listening for a window resize event vs a canvas (or the div containing the canvas) resize? If that’s correct, how do I listen for the canvas size changing?

Without the playground, any thoughts off the top of your brilliant collective heads?
Thanks so much.

Do you have an event when the splitter resize the sections? This could be used to trigger the engine.resize

Else (pseudo-code):

scene.registerBeforeRender(() => {
 if (old canvas size !== current canvas size) then resize engine
});
2 Likes

Perfect! Worked like a charm. Thanks very much!

1 Like