2019-08-28 06:50:38 +08:00
|
|
|
import { ResizableWidget } from "./ResizableWidget";
|
2019-08-21 23:56:46 +08:00
|
|
|
import { Renderer } from "../rendering/Renderer";
|
2019-12-27 07:55:32 +08:00
|
|
|
import { div } from "./dom";
|
2019-08-20 04:56:40 +08:00
|
|
|
|
2019-08-28 06:50:38 +08:00
|
|
|
export class RendererWidget extends ResizableWidget {
|
2019-12-27 07:55:32 +08:00
|
|
|
readonly element = div({ className: "core_RendererWidget" });
|
2019-09-16 01:32:34 +08:00
|
|
|
|
2019-08-20 04:56:40 +08:00
|
|
|
constructor(private renderer: Renderer) {
|
2019-09-16 01:32:34 +08:00
|
|
|
super();
|
2019-08-20 04:56:40 +08:00
|
|
|
|
2019-12-22 07:43:27 +08:00
|
|
|
this.element.append(renderer.canvas_element);
|
2019-08-20 04:56:40 +08:00
|
|
|
|
|
|
|
this.disposable(renderer);
|
2019-09-14 21:15:59 +08:00
|
|
|
|
2019-12-20 01:54:01 +08:00
|
|
|
this.finalize_construction();
|
2019-08-21 23:56:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
start_rendering(): void {
|
|
|
|
this.renderer.start_rendering();
|
|
|
|
}
|
2019-08-20 04:56:40 +08:00
|
|
|
|
2019-08-21 23:56:46 +08:00
|
|
|
stop_rendering(): void {
|
|
|
|
this.renderer.stop_rendering();
|
2019-08-20 04:56:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
resize(width: number, height: number): this {
|
|
|
|
super.resize(width, height);
|
|
|
|
|
|
|
|
this.renderer.set_size(width, height);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|