ts-ui-test/src/ui/canvas.ts

24 lines
603 B
TypeScript
Raw Normal View History

2023-05-02 16:44:10 +00:00
import { UINode } from "./node";
export class Canvas extends UINode {
private canvasElement: HTMLCanvasElement;
public constructor(title: string) {
super(title);
this.canvasElement = document.createElement("canvas");
this.canvasElement.setAttribute("tabindex", "-1");
this.element.appendChild(this.canvasElement);
}
public focus() {
this.canvasElement.focus();
}
public click() {
this.canvasElement.click();
}
public getElement(): HTMLElement {
return this.canvasElement;
}
}