|
@@ -13,9 +13,6 @@ const KeySpace = 32;
|
|
|
|
|
|
export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
- parent: HTMLElement | undefined = undefined;
|
|
|
-
|
|
|
-
|
|
|
state = RxValue.create({
|
|
|
width: 1500,
|
|
|
height: 1000,
|
|
@@ -77,13 +74,12 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
}
|
|
|
|
|
|
moveEditor(){
|
|
|
- if(!this.parent) return;
|
|
|
- this.parent.style.cursor = this.state.moveMode ? "default" : "grab";
|
|
|
+ if(!this.doms.parent?.value) return;
|
|
|
+ this.doms.parent.value.style.cursor = this.state.moveMode ? "default" : "grab";
|
|
|
this.state.setMoveMode(!this.state.moveMode);
|
|
|
}
|
|
|
|
|
|
initEditorEvent(editorLayer:HTMLElement, parent:HTMLElement) {
|
|
|
- this.parent = parent;
|
|
|
// 监听键盘的 keydown 事件
|
|
|
document.addEventListener("keydown", (event)=>{
|
|
|
this.state.keyCode = event.keyCode;
|
|
@@ -186,12 +182,12 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
const parent = this.doms.parent.value as HTMLElement;
|
|
|
const left = ( parent.clientWidth - state.width) / 2.0;
|
|
|
const top = (parent.clientHeight - state.height) / 2.0;
|
|
|
-
|
|
|
+
|
|
|
this.state.setPos({x: left, y: top});
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
- autoInScreen() {
|
|
|
- this.updateEditorSize();
|
|
|
+autoInScreen() {
|
|
|
+ this.updateEditorSize();
|
|
|
this.setScale(1);
|
|
|
}
|
|
|
|