I think you can do that in two ways:
- Use
elm/browser
's Browser.Dom - browser 1.0.2 atinit
and ask thecanvas
parent its dimensions. You probably wantscene
widths and heights here. - Measure
canvas
parent dimensions with JS at startup time viaelement.getBoundingClientRect()
(see Element.getBoundingClientRect() - Web APIs | MDN) and pass such values to Elm via flags.
You might want to keep track of window resize too (and potentially resize of the canvas parent) so you have to install a subscription
for the resize
event too in your Elm app.