mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 07:35:19 +00:00
Spawn Bevy canvas at full viewport size
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as studio from "@storyteller/studio";
|
||||
import { ViewportSize } from "@storyteller/studio";
|
||||
|
||||
import "./app.element.scss";
|
||||
|
||||
@@ -9,11 +10,8 @@ export class AppElement extends HTMLElement {
|
||||
// TODO: This siezes up the whole browser for several seconds, presumably
|
||||
// while the WASM binary is loading. Is there any way to do this
|
||||
// asynchronously?
|
||||
// TODO: Since we're using `#[wasm_bindgen]` attributes instead of the
|
||||
// CLI, we can craft our own JS API to interact with Bevy! \o/ As a start,
|
||||
// we should exploit this to pass an explicit canvas size to Bevy and keep
|
||||
// it up to date with the browser viewport size.
|
||||
studio.init();
|
||||
const { width, height } = document.body.getBoundingClientRect();
|
||||
studio.init(new ViewportSize(width, height));
|
||||
}
|
||||
}
|
||||
customElements.define("app-root", AppElement);
|
||||
|
||||
Reference in New Issue
Block a user