plnkr / feedback

Feedback on Plunker
19 stars 11 forks source link

PlayCanvas demo not scaling to requested size in Preview #599

Closed 8Observer8 closed 11 months ago

8Observer8 commented 11 months ago

The requested size of canvas is 300x300 but it is bigger in Preview: https://plnkr.co/edit/nEchdgd1UQYDClR1?preview

image

ggoodman commented 11 months ago

Hey, if I remember correctly, there's some subtle trickery going on in the preview. It's an iframe nested within another controller iframe. I believe that the nested iframe gets resized to fit the container given that the space allocated to that controlling iframe is unknown a priori.

The following code in your plunk is probably responsible:

// Ensure canvas is resized when window changes size
window.addEventListener("resize", () => app.resizeCanvas());
8Observer8 commented 11 months ago

I commented it out and the issue was fixed. Thank you very much!

// Ensure canvas is resized when window changes size
// window.addEventListener("resize", () => app.resizeCanvas());