diff --git a/packages/renderer-webgl/source/kernel/WebGLCanvas.ts b/packages/renderer-webgl/source/kernel/WebGLCanvas.ts index 773ebbc..2aa8335 100644 --- a/packages/renderer-webgl/source/kernel/WebGLCanvas.ts +++ b/packages/renderer-webgl/source/kernel/WebGLCanvas.ts @@ -61,7 +61,7 @@ type WebGLCanvasEventMap = { class WebGLCanvas extends EventEmitter { - public readonly canvas: HTMLCanvasElement | OffscreenCanvas; + public readonly element: HTMLCanvasElement | OffscreenCanvas; public readonly context: WebGLRenderingContext | WebGL2RenderingContext; @@ -214,7 +214,7 @@ class WebGLCanvas extends EventEmitter { } } - this.canvas = targetCanvas; + this.element = targetCanvas; this.context = targetContext; this.glVersion = targetGLVersion; this.isOffScreen = targetIsOffScreen; @@ -238,12 +238,12 @@ class WebGLCanvas extends EventEmitter { let hasResized = false; if (width !== void 0) { - this.canvas.width = width; + this.element.width = width; hasResized = true; } if (height !== void 0) { - this.canvas.height = height; + this.element.height = height; hasResized = true; } @@ -280,8 +280,8 @@ class WebGLCanvas extends EventEmitter { } } - if (targetcontainer === null && this.canvas instanceof HTMLCanvasElement) { - targetcontainer = this.canvas.parentElement; + if (targetcontainer === null && this.element instanceof HTMLCanvasElement) { + targetcontainer = this.element.parentElement; } if (targetcontainer === null) { @@ -307,11 +307,11 @@ class WebGLCanvas extends EventEmitter { this.resizeObserver = resizeObserver; - if (this.canvas instanceof HTMLElement) { - this.canvas.style.width = "100%"; - this.canvas.style.height = "100%"; - this.canvas.style.boxSizing = "border-box"; - this.canvas.style.display = "block"; + if (this.element instanceof HTMLElement) { + this.element.style.width = "100%"; + this.element.style.height = "100%"; + this.element.style.boxSizing = "border-box"; + this.element.style.display = "block"; } resizeObserver.observe(targetcontainer);