UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

23 lines (22 loc) 693 B
"use strict"; import { CoreGraphNode } from "../../../core/graph/CoreGraphNode"; export class WindowController { constructor(_scene) { this._scene = _scene; this._onWindowResizeBound = this._onWindowResize.bind(this); } graphNode() { return this._graphNode = this._graphNode || this._createGraphNode(); } _createGraphNode() { const coreGraphNode = new CoreGraphNode(this._scene, "SceneWindowController"); globalThis.addEventListener("resize", this._onWindowResizeBound); return coreGraphNode; } _onWindowResize() { this.graphNode().setSuccessorsDirty(); } dispose() { globalThis.removeEventListener("resize", this._onWindowResizeBound); } }