|
@@ -7,6 +7,7 @@ import { RxValue } from "../ReactCtrl/rxValue";
|
|
|
import { DisplayObject } from "../SelectCtrl/objects/displayObject";
|
|
|
import { ObjsContainer } from "../SelectCtrl/ObjsContainer";
|
|
|
import { settingsStore } from "@queenjs-modules/queditor/module/stores/settings";
|
|
|
+import { object } from "vue-types";
|
|
|
|
|
|
|
|
|
const KeySpace = 32;
|
|
@@ -83,6 +84,7 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
this.state.setMoveMode(!this.state.moveMode);
|
|
|
}
|
|
|
|
|
|
+ editRoot = new ObjsContainer([]);
|
|
|
initEditorEvent(editorLayer:HTMLElement, parent:HTMLElement) {
|
|
|
this.parent = parent;
|
|
|
// 监听键盘的 keydown 事件
|
|
@@ -118,7 +120,7 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
let moveX = 0, moveY = 0;
|
|
|
|
|
|
|
|
|
- const obj = new ObjsContainer([]);
|
|
|
+ const obj = this.editRoot;
|
|
|
this.state.onWidthChanged(()=>{
|
|
|
obj.rect.width = this.state.width;
|
|
|
})
|
|
@@ -213,8 +215,25 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
|
|
|
}
|
|
|
|
|
|
autoInScreen() {
|
|
|
- this.updateEditorSize();
|
|
|
+
|
|
|
this.setScale(1);
|
|
|
+ const bound = this.store.currStreamCard.$el.getBoundingClientRect();
|
|
|
+ console.log(bound.width, bound.height);
|
|
|
+
|
|
|
+ const parent = this.doms.parent.value as HTMLElement;
|
|
|
+
|
|
|
+ const parentb = parent.getBoundingClientRect();
|
|
|
+
|
|
|
+ const left = parentb.left + ( parentb.width - bound.width) / 2.0; //屏幕坐标位置
|
|
|
+ const top = parentb.top + ( parentb.height - bound.height) / 2.0;
|
|
|
+
|
|
|
+ let offsetX = left - bound.left;
|
|
|
+ let offsetY = top -bound.top;
|
|
|
+
|
|
|
+ this.editRoot.translate(offsetX, offsetY);
|
|
|
+
|
|
|
+ const editor = this.doms.editor.value as HTMLElement;
|
|
|
+ editor.style.transform = this.editRoot.parent.worldTransform.getMatrixStr();
|
|
|
}
|
|
|
|
|
|
setScale(scale: number) {
|