Does anyone have any insight into how WASM is buil...
# compose-web
j
Does anyone have any insight into how WASM is building out the canvas (height and width). I know it is based on the parent element but I am having trouble getting it to go to the full size of available space without needing to resize the browser multiple times. I am trying to add in KMP WASM output into a pre-existing HTML page. I am trying to follow all of the guides but every example and guide seems to utilize the body directly. I have to be in a subelement of body (creating a div as the root where I want to insert WASM). It is showing the UI correctly but the base dev element does not go to the full size of the content window I want. Not sure if its a HTML issue or something with how the canvas is dynamically resized? I have already tried a few different methods in CSS and HTML on the root container div (style="height: 100%; width: 100%") but nothing has worked. Any help is appreciated. Thank you
o
If you're using the entire browser viewport, you might want to look into CanvasBasedWindow, in particular its
requestResize
and
applyDefaultStyles
parameters. Also, see the DefaultWindowState size change listener if you don't supply your own. Does that help?
j
Not trying to use the whole viewport right now just use an existing space in HTML to put it in. I think I am going to build out a JS on load listener to dynamically change the size
o
So which @Composable function do you use to fill your canvas element?
j
Currently using ComposeViewport
o
According to its documentation, it should adjust its size with its container. It uses DefaultWindowState to do so. If that doesn't work correctly, maybe you'd file an issue on YouTrack with a reproducer?
🙌 1
j
Thank you