2019-12-20 03:02:52 +08:00
|
|
|
import { RendererWidget } from "../../core/gui/RendererWidget";
|
|
|
|
import { QuestRenderer } from "../rendering/QuestRenderer";
|
2019-12-22 02:40:42 +08:00
|
|
|
import { QuestEditorStore } from "../stores/QuestEditorStore";
|
2019-12-27 07:55:32 +08:00
|
|
|
import { div } from "../../core/gui/dom";
|
2020-01-05 08:07:35 +08:00
|
|
|
import { ResizableView } from "../../core/gui/ResizableView";
|
2019-12-20 03:02:52 +08:00
|
|
|
|
2020-01-05 08:07:35 +08:00
|
|
|
export abstract class QuestRendererView extends ResizableView {
|
2020-07-15 01:46:11 +08:00
|
|
|
private readonly renderer_widget: RendererWidget;
|
2019-12-20 03:02:52 +08:00
|
|
|
|
|
|
|
protected readonly renderer: QuestRenderer;
|
|
|
|
|
|
|
|
readonly element: HTMLElement;
|
|
|
|
|
2019-12-22 02:40:42 +08:00
|
|
|
protected constructor(
|
|
|
|
quest_editor_store: QuestEditorStore,
|
|
|
|
className: string,
|
|
|
|
renderer: QuestRenderer,
|
|
|
|
) {
|
2019-12-20 03:02:52 +08:00
|
|
|
super();
|
|
|
|
|
2020-07-15 01:46:11 +08:00
|
|
|
this.element = div({ className, tabIndex: -1 });
|
2019-12-20 03:02:52 +08:00
|
|
|
this.renderer = renderer;
|
2020-07-15 01:46:11 +08:00
|
|
|
this.renderer_widget = this.add(new RendererWidget(this.renderer));
|
|
|
|
this.element.append(this.renderer_widget.element);
|
2019-12-20 03:02:52 +08:00
|
|
|
|
|
|
|
this.disposables(
|
|
|
|
quest_editor_store.debug.observe(({ value }) => (this.renderer.debug = value)),
|
|
|
|
);
|
2020-01-05 08:07:35 +08:00
|
|
|
}
|
|
|
|
|
2019-12-20 03:02:52 +08:00
|
|
|
resize(width: number, height: number): this {
|
|
|
|
super.resize(width, height);
|
|
|
|
|
2020-07-15 01:46:11 +08:00
|
|
|
this.renderer_widget.resize(width, height);
|
2019-12-20 03:02:52 +08:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|