How to update application canvas area after being moved into another div?

Hey everybody,

I hope someone is able to help me, with this.

I have been struggling with a problem regarding the application canvas area.

The project is using the htmlhandler (mainmenucomponent), to load bootstrap, which im using for some “nifty” repositioning.

Im using the same solution as mentioned in this post, to move the canvas into a div. Works really well.

Link:

The problem consists of the canvas getting distorted, until the window is resized. Is there a method to update the canvas after its been moved into the div? Or is the problem something else?

Im a novice coder, that wants to make some cool configurators, this is my first post :slight_smile:

Thank you in advance

Link to the editor:

https://playcanvas.com/editor/scene/1021016

Looks like you need to call https://developer.playcanvas.com/en/api/pc.Application.html#resizeCanvas to resize the render resolution.

1 Like

Thank you, i will look into it.

It helped me to style only the div instead of the applicationcanvas. The canvas adjust, so it works fine now, :slight_smile:

However it would be smoother solving it directly on window resize, so i will try to implement resizeCanvas