Canvas not setting to window size #936
-
I am using a React-Three-Fiber scene as part of a bigger web site that is using router to navigate from page to page. So, the 3d Canvas is part of a component. When I set it up and it was the only thing -- the "App" it worked as expected. But now that it is a separate component and I am using router to navigate to it, it is not setting it's canvas size to be the window size. Where and how can I set it to be the window size? I see that I can do this -- <Canvas style={{ height: 1000, width: 1000 }}> which sets it in pixels. I have tried to use 100vh and 100vw, but that doesn't work. thanks for any help, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The Canvas will take the size of its parent element: <div style={{ width: "100vw", height: "100vh" }}>
<Canvas />
</div> |
Beta Was this translation helpful? Give feedback.
-
Same I am also using react three fiber canvas . Yes it working but I have a side navigation bar while closing and open the side navigation bar then the canvas are not getting update and in the same code I am using the 3 orthographic cameras pointing towords scene then i am creating subviews like top, front and side views of object but these subviews also not getting updated ...... beacuse i am using the same canvas for main view and subviews also .. please give sugestions.. |
Beta Was this translation helpful? Give feedback.
The Canvas will take the size of its parent element: