Rename WebGLCanvas.canvas to WebGLCanvas.element.
This commit is contained in:
parent
c8fe5854ab
commit
4cd5ebb936
@ -61,7 +61,7 @@ type WebGLCanvasEventMap = {
|
||||
|
||||
class WebGLCanvas extends EventEmitter<WebGLCanvasEventMap> {
|
||||
|
||||
public readonly canvas: HTMLCanvasElement | OffscreenCanvas;
|
||||
public readonly element: HTMLCanvasElement | OffscreenCanvas;
|
||||
|
||||
public readonly context: WebGLRenderingContext | WebGL2RenderingContext;
|
||||
|
||||
@ -214,7 +214,7 @@ class WebGLCanvas extends EventEmitter<WebGLCanvasEventMap> {
|
||||
}
|
||||
}
|
||||
|
||||
this.canvas = targetCanvas;
|
||||
this.element = targetCanvas;
|
||||
this.context = targetContext;
|
||||
this.glVersion = targetGLVersion;
|
||||
this.isOffScreen = targetIsOffScreen;
|
||||
@ -238,12 +238,12 @@ class WebGLCanvas extends EventEmitter<WebGLCanvasEventMap> {
|
||||
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<WebGLCanvasEventMap> {
|
||||
}
|
||||
}
|
||||
|
||||
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<WebGLCanvasEventMap> {
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user