|
@@ -1,4 +1,4 @@
|
|
|
-import { ModuleControl } from "queenjs";
|
|
|
+import { Effect, ModuleControl } from "queenjs";
|
|
|
import { reactive } from "vue";
|
|
|
import { EditorModule } from "../../module";
|
|
|
import { ObjsContainer } from "./ObjsContainer";
|
|
@@ -33,7 +33,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
showGizmo: false,
|
|
|
width: 0,
|
|
|
height: 0,
|
|
|
- relWidth: 0,
|
|
|
+ relWidth: 0,
|
|
|
relHeight: 0,
|
|
|
matrix: "matrix(1,0,0,1,0,0)",
|
|
|
matrixInvert: "matrix(1,0,0,1,0,0)",
|
|
@@ -77,22 +77,59 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this._selCanvaseSize.w = selCanvas.width * 2;
|
|
|
this._selCanvaseSize.h = selCanvas.height * 2;
|
|
|
|
|
|
- viewport.addEventListener("mousedown", this.onDocMouseDown.bind(this), {capture: true});
|
|
|
+ viewport.addEventListener("mousedown", this.onDocMouseDown.bind(this), {
|
|
|
+ capture: true,
|
|
|
+ });
|
|
|
window.addEventListener("resize", this.onResize.bind(this));
|
|
|
+
|
|
|
+ this.initEffects();
|
|
|
+ }
|
|
|
+
|
|
|
+ initEffects() {
|
|
|
+ //相应相应的事件
|
|
|
+ Effect.array(()=>this.store.selected).list({
|
|
|
+ remove:()=>{
|
|
|
+ console.log("xxx")
|
|
|
+ },
|
|
|
+ change:(added:string[], removed:string[])=>{
|
|
|
+ console.log("changeMap=>", added, removed)
|
|
|
+ this._updateSelects();
|
|
|
+ },
|
|
|
+ }).run();
|
|
|
}
|
|
|
|
|
|
_mouseDownFlag = "";
|
|
|
_mouseDownTimestamp = 0;
|
|
|
|
|
|
+ _containers:Map<string, ObjsContainer> = new Map();
|
|
|
+
|
|
|
+ _updateSelects() {
|
|
|
+ const selecteds = this.store.selected;
|
|
|
+ const ObjC = this._containers.get(this.store.selectId)
|
|
|
+ let objs = [];
|
|
|
+ for (let item of selecteds) {
|
|
|
+ objs.push( new CompObject(this.compMap[item]) )
|
|
|
+ }
|
|
|
+ this.selecteObjs(objs, ObjC);
|
|
|
+ if (this.store.selectId) {
|
|
|
+ this._containers.set(this.store.selectId, this.objContainer as ObjsContainer);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onDocMouseDown(e: MouseEvent) {
|
|
|
this._mouseDownTimestamp = Date.now();
|
|
|
|
|
|
if (!this.pageEl || !this.selCanvas) return;
|
|
|
if (this.store.textEditingState) return;
|
|
|
-
|
|
|
- document.addEventListener("mousemove", this.onDocMouseMove, {capture: true});
|
|
|
+
|
|
|
+ document.addEventListener("mousemove", this.onDocMouseMove, {
|
|
|
+ capture: true,
|
|
|
+ });
|
|
|
//mouseup和click都会被触发, 监听click事件可以阻止子组件的点击行为
|
|
|
- document.addEventListener("click", this.onDocMouseUp.bind(this), {capture: true, once: true});
|
|
|
+ document.addEventListener("click", this.onDocMouseUp.bind(this), {
|
|
|
+ capture: true,
|
|
|
+ once: true,
|
|
|
+ });
|
|
|
|
|
|
let box = this.pageEl.getBoundingClientRect();
|
|
|
const pageX = e.clientX - box?.left;
|
|
@@ -127,21 +164,19 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this._state = MODE_MOVING;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (!isClickSelRect) {
|
|
|
//判断是否有点击到card stream
|
|
|
const comps = this.compClickTest(e);
|
|
|
- console.log("comps=>", comps);
|
|
|
+ console.log("comps=>", comps);
|
|
|
if (comps.length < 1) {
|
|
|
-
|
|
|
- const test = this.streamCardClickTest(e)
|
|
|
+ const test = this.streamCardClickTest(e);
|
|
|
if (test) {
|
|
|
const childs = this.compMap[test.id].children.default || [];
|
|
|
if (childs.length < 1) {
|
|
|
- return;
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const view = this.viewport?.getBoundingClientRect() as any;
|
|
|
const isOut =
|
|
|
e.clientX < view.left ||
|
|
@@ -151,7 +186,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
if (!isOut) {
|
|
|
this._state = MODE_SEL_RECT;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
//else {
|
|
|
// this._state = MODE_MOVING;
|
|
|
// const obj = this.compMap[comps[0].id];
|
|
@@ -168,8 +203,13 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
this._movePreClientX = this._downClientX;
|
|
|
this._movePreClientY = this._downClientY;
|
|
|
-
|
|
|
+
|
|
|
+ if (this._state == MODE_MOVING) {
|
|
|
+ const obj = this.objContainer as ObjsContainer;
|
|
|
+ this._initMovePos = { x: obj.parent.x, y: obj.parent.y };
|
|
|
+ }
|
|
|
}
|
|
|
+ _initMovePos = { x: 0, y: 0 };
|
|
|
|
|
|
getDivFlag(div: HTMLElement) {
|
|
|
let c: any = div;
|
|
@@ -193,7 +233,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
const pbox = this.pageEl.getBoundingClientRect();
|
|
|
const pageX = e.clientX - pbox?.left;
|
|
|
|
|
|
- const Out:any[] = [];
|
|
|
+ const Out: any[] = [];
|
|
|
while (n--) {
|
|
|
const cardComp = compMap[cards[n]];
|
|
|
const box = cardComp.$el.getBoundingClientRect();
|
|
@@ -220,7 +260,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
cardY: cardY,
|
|
|
cardId: cards[n],
|
|
|
startMatrix: m,
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -260,6 +300,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
movingMousemove(e: MouseEvent) {
|
|
|
const objContainer = this.objContainer as ObjsContainer;
|
|
|
|
|
|
+ objContainer.setPivot(0);
|
|
|
objContainer.translate(
|
|
|
e.clientX - this._movePreClientX,
|
|
|
e.clientY - this._movePreClientY
|
|
@@ -278,8 +319,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
// return;
|
|
|
// }
|
|
|
if (this._state) {
|
|
|
- e.preventDefault();
|
|
|
- e.stopPropagation();
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopPropagation();
|
|
|
}
|
|
|
|
|
|
switch (this._state) {
|
|
@@ -298,14 +339,16 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
this._movePreClientY = e.clientY;
|
|
|
this._movePreClientX = e.clientX;
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
get compMap() {
|
|
|
return this.store.designData.compMap;
|
|
|
}
|
|
|
|
|
|
onDocMouseUp(e: MouseEvent) {
|
|
|
- document.removeEventListener("mousemove", this.onDocMouseMove, {capture: true});
|
|
|
+ document.removeEventListener("mousemove", this.onDocMouseMove, {
|
|
|
+ capture: true,
|
|
|
+ });
|
|
|
|
|
|
if (this._mouseDownFlag == "toolbar") {
|
|
|
return;
|
|
@@ -318,18 +361,17 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
if (dx < 2 && dy < 2 && !this.store.textEditingState && offsetT < 200) {
|
|
|
isClick = true;
|
|
|
}
|
|
|
- if (isClick) {
|
|
|
+ if (isClick) {
|
|
|
this._state = MODE_NONE;
|
|
|
const comps = this.compClickTest(e);
|
|
|
if (comps.length < 1) {
|
|
|
setTimeout(() => {
|
|
|
- this.selecteObjs([]);
|
|
|
+ this.actions.selectObjs([]) //清空选择
|
|
|
}, 0);
|
|
|
}
|
|
|
- } else{
|
|
|
+ } else {
|
|
|
e.stopPropagation();
|
|
|
}
|
|
|
- console.log("up");
|
|
|
|
|
|
if (this._state == MODE_SEL_RECT && !isClick) {
|
|
|
//选择空间转 streamCard空间
|
|
@@ -345,10 +387,12 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
if (this._state == MODE_ROTATE) {
|
|
|
this.rotateMouseUp(e);
|
|
|
- }
|
|
|
- if (this._state == MODE_SCALE) {
|
|
|
+ } else if (this._state == MODE_SCALE) {
|
|
|
this.scaleMouseUp(e);
|
|
|
+ } else if (this._state == MODE_MOVING) {
|
|
|
+ this.moveMouseUp(e);
|
|
|
}
|
|
|
+
|
|
|
this._state = MODE_NONE;
|
|
|
this._downed = false;
|
|
|
this._moveSelectUpdated = false;
|
|
@@ -359,6 +403,46 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this._selCanvaseSize.h
|
|
|
);
|
|
|
this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ }
|
|
|
+ moveMouseUp(e: MouseEvent) {
|
|
|
+ const history = this.controls.historyCtrl.history;
|
|
|
+
|
|
|
+ const obj = this.objContainer as ObjsContainer;
|
|
|
+ const lastX = obj.parent.x,
|
|
|
+ lastY = obj.parent.y;
|
|
|
+
|
|
|
+ const initX = this._initMovePos.x,
|
|
|
+ initY = this._initMovePos.y;
|
|
|
+
|
|
|
+ obj.setPivot(0);
|
|
|
+
|
|
|
+ history.record({
|
|
|
+ undo: () => {
|
|
|
+ console.log("undo ");
|
|
|
+ const currObj = this.objContainer as ObjsContainer;
|
|
|
+ currObj.setPivot(0);
|
|
|
+ currObj.parent.x = initX;
|
|
|
+ currObj.parent.y = initY;
|
|
|
+ currObj.parent.updateTransform();
|
|
|
+ currObj.updateCompState();
|
|
|
+
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+ redo: () => {
|
|
|
+
|
|
|
+ const currObj = this.objContainer as ObjsContainer;
|
|
|
+ currObj.setPivot(0);
|
|
|
+ currObj.parent.x = lastX;
|
|
|
+ currObj.parent.y = lastY;
|
|
|
+ currObj.parent.updateTransform();
|
|
|
+ currObj.updateCompState();
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+ } as any);
|
|
|
+ history.submit();
|
|
|
}
|
|
|
|
|
|
rectSelect(x: number, y: number, width: number, height: number) {
|
|
@@ -370,16 +454,13 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
const o = new CompObject(this.compMap[childs[n]]);
|
|
|
if (o.testRect({ x, y, w: width, h: height }, true)) {
|
|
|
//相交
|
|
|
- outs.push(o);
|
|
|
+ outs.push(o.comp.id);
|
|
|
}
|
|
|
}
|
|
|
- console.log(outs);
|
|
|
-
|
|
|
- this.selecteObjs(outs);
|
|
|
+ this.actions.selectObjs(outs);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
upgateGizmoStyle() {
|
|
|
- this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
this.transferStyle.mode = this._state;
|
|
|
|
|
|
if (this.selected.length < 1) {
|
|
@@ -389,8 +470,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
this.transferStyle.showGizmo = false;
|
|
|
|
|
|
- //@ts-ignore
|
|
|
- const yoff = this.store.currStreamCard.$el.getBoundingClientRect().top - this.pageEl?.getBoundingClientRect().top;
|
|
|
+ //@ts-ignore
|
|
|
+ const yoff = this.store.currStreamCard.$el.getBoundingClientRect().top - this.pageEl?.getBoundingClientRect().top;
|
|
|
this.transferStyle.baseCardTop = yoff + "px";
|
|
|
|
|
|
const selector = this.objContainer as ObjsContainer;
|
|
@@ -407,11 +488,10 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
tmp.copyFrom(obj.worldTransform);
|
|
|
let matrix = `matrix(${tmp.a},${tmp.b},${tmp.c},${tmp.d},${tmp.tx},${tmp.ty})`;
|
|
|
|
|
|
- tmp.rotate( -tmp.getRotate() )
|
|
|
+ tmp.rotate(-tmp.getRotate());
|
|
|
tmp.invert();
|
|
|
let matrixInvert = `matrix(${tmp.a},${tmp.b},${tmp.c},${tmp.d},0,0)`;
|
|
|
|
|
|
-
|
|
|
this.transferStyle.width = w;
|
|
|
this.transferStyle.height = h;
|
|
|
this.transferStyle.relWidth = w * obj.scale.x;
|
|
@@ -494,10 +574,6 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
)
|
|
|
return;
|
|
|
|
|
|
- // objs = this.getSceneObjOrderArr(objs);
|
|
|
-
|
|
|
- const preObjContainer = this.objContainer;
|
|
|
-
|
|
|
if (this.objContainer) {
|
|
|
this.objContainer.destroy();
|
|
|
this.objContainer = undefined;
|
|
@@ -516,51 +592,10 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
}
|
|
|
}
|
|
|
this.objContainer = newObjContainer;
|
|
|
-
|
|
|
- const pre = this.selected.slice(0);
|
|
|
this.selected = objs;
|
|
|
|
|
|
- // if (history) {
|
|
|
- // this.editor.history.record({
|
|
|
- // undo: () => {
|
|
|
-
|
|
|
- // this.selected = pre;
|
|
|
-
|
|
|
- // if (preObjContainer) {
|
|
|
- // let parent = preObjContainer.parent;
|
|
|
- // pre.forEach(obj => {
|
|
|
- // parent.addChildWorldNoChange(obj);
|
|
|
- // });
|
|
|
- // parent.updateTransform();
|
|
|
- // this.objContainer = preObjContainer;
|
|
|
- // } else {
|
|
|
- // this.objContainer = null;
|
|
|
- // }
|
|
|
-
|
|
|
- // this.emitChange();
|
|
|
-
|
|
|
- // }, redo: () => {
|
|
|
- // this.selected = objs;
|
|
|
-
|
|
|
- // if (preObjContainer) {
|
|
|
- // preObjContainer.destroy();
|
|
|
- // }
|
|
|
-
|
|
|
- // if (newObjContainer) {
|
|
|
- // let parent = newObjContainer.parent;
|
|
|
- // objs.forEach(obj => {
|
|
|
- // parent.addChildWorldNoChange(obj);
|
|
|
- // });
|
|
|
- // parent.updateTransform();
|
|
|
- // this.objContainer = newObjContainer;
|
|
|
- // } else {
|
|
|
- // this.objContainer = null;
|
|
|
- // }
|
|
|
- // this.emitChange();
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
this.emitChange();
|
|
|
+
|
|
|
this.upgateGizmoStyle();
|
|
|
|
|
|
return this.selected;
|
|
@@ -653,15 +688,34 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
let last = this.lastRad;
|
|
|
let initrad = scope.objinitAngleRad;
|
|
|
|
|
|
- // this.editor.history.record({undo:function(){
|
|
|
- // scope.objContainer.setPivot(4);
|
|
|
- // scope.objContainer.rotate( initrad );
|
|
|
- // scope.emitChange();
|
|
|
- // }, redo:function(){
|
|
|
- // scope.objContainer.setPivot(4);
|
|
|
- // scope.objContainer.rotate( last );
|
|
|
- // scope.emitChange();
|
|
|
- // }});
|
|
|
+ const history = this.controls.historyCtrl.history;
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+
|
|
|
+ history.record({
|
|
|
+ undo: () => {
|
|
|
+
|
|
|
+ const objContainer = this.objContainer as ObjsContainer;
|
|
|
+
|
|
|
+ this.objContainer?.setPivot(4);
|
|
|
+ this.objContainer?.rotate(initrad);
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+ this.objContainer?.updateCompState();
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+
|
|
|
+ redo: () => {
|
|
|
+ console.log("redo ");
|
|
|
+ const objContainer = this.objContainer as ObjsContainer;
|
|
|
+ this.objContainer?.setPivot(4);
|
|
|
+ this.objContainer?.rotate(last);
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+ this.objContainer?.updateCompState();
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+ } as any);
|
|
|
+ history.submit();
|
|
|
this.rotateCmd = false;
|
|
|
}
|
|
|
|
|
@@ -678,7 +732,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
scaleCmd = false;
|
|
|
lastScale = { x: 1, y: 1 };
|
|
|
|
|
|
- initScaleWith = {w: 0, h:0};
|
|
|
+ initScaleWith = { w: 0, h: 0 };
|
|
|
|
|
|
scaleMousemove(event: MouseEvent) {
|
|
|
let dirIndexs = [
|
|
@@ -702,7 +756,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
scaleIndex = dirOrth.indexOf(dir);
|
|
|
if (scaleIndex == 2) scaleIndex = 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let pivot = objContainer.setPivot(scaleIndex);
|
|
|
|
|
|
this.scaleIndex = scaleIndex;
|
|
@@ -711,7 +765,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this.mainAxisVector = { x: StartX - pivot.x, y: StartY - pivot.y };
|
|
|
let scale = objContainer.parent.scale;
|
|
|
this.initScale = { x: scale.x, y: scale.y };
|
|
|
- this.initScaleWith = {w: objContainer.width, h: objContainer.height}
|
|
|
+ this.initScaleWith = { w: objContainer.width, h: objContainer.height };
|
|
|
|
|
|
this.mainAxisVectorLenth = VectorLenth(
|
|
|
this.mainAxisVector.x,
|
|
@@ -738,37 +792,28 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
let dtaY = Project(vec, this.yAxisVector) / this.yAxisVectorLength;
|
|
|
this.lastScale.x = dtaX * this.initScale.x;
|
|
|
this.lastScale.y = dtaY * this.initScale.y;
|
|
|
- // objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
- const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
- objContainer.scaleSize(currW, this.lastScale.y * this.initScaleWith.h);
|
|
|
-
|
|
|
+ // objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
+ const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
+ objContainer.scaleSize(currW, this.lastScale.y * this.initScaleWith.h);
|
|
|
} else {
|
|
|
let mainVec = this.mainAxisVector;
|
|
|
let dtaScale = Project(vec, mainVec) / this.mainAxisVectorLenth;
|
|
|
- console.log( "dtaScale=>" , dtaScale );
|
|
|
+ console.log("dtaScale=>", dtaScale);
|
|
|
|
|
|
let i = dirOrth.indexOf(this._mouseDownFlag);
|
|
|
if (i == -1) {
|
|
|
this.lastScale.x = dtaScale * this.initScale.x;
|
|
|
this.lastScale.y = dtaScale * this.initScale.y;
|
|
|
// objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
- const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
- objContainer.scaleSize(currW, this.initScaleWith.h *this.lastScale.y);
|
|
|
- // objContainer.scaleHeight(, dtaScale);
|
|
|
-
|
|
|
+ objContainer.scaleSize(this.lastScale.x, this.lastScale.y);
|
|
|
} else if (i == 0 || i == 1) {
|
|
|
-
|
|
|
-
|
|
|
this.lastScale.x = dtaScale * this.initScale.x;
|
|
|
// objContainer.scaleX(this.lastScale.x);
|
|
|
- const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
- objContainer.scaleWidth(currW);
|
|
|
-
|
|
|
+ objContainer.scaleWidth(this.lastScale.x);
|
|
|
} else if (i == 2 || i == 3) {
|
|
|
this.lastScale.y = dtaScale * this.initScale.y;
|
|
|
-
|
|
|
// objContainer.scaleY(this.lastScale.y);
|
|
|
- objContainer.scaleHeight(this.lastScale.y * this.initScaleWith.h);
|
|
|
+ objContainer.scaleHeight(this.lastScale.y);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -781,27 +826,34 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
let preScale = { x: this.initScale.x, y: this.initScale.y };
|
|
|
let scaleIndex = this.scaleIndex;
|
|
|
let lastScale = { x: this.lastScale.x, y: this.lastScale.y };
|
|
|
- // this.objContainer?.applyScaleToChildSize();
|
|
|
- // this.upgateGizmoStyle();
|
|
|
- // this.editor.history.record({
|
|
|
- // undo:()=>{
|
|
|
- // this.objContainer.setPivot( scaleIndex );
|
|
|
- // this.objContainer.scale(preScale.x, preScale.y);
|
|
|
-
|
|
|
- // this.emitChange();
|
|
|
- // },
|
|
|
- // redo:()=>{
|
|
|
- // this.objContainer.setPivot( scaleIndex );
|
|
|
- // this.objContainer.scale(lastScale.x, lastScale.y);
|
|
|
-
|
|
|
- // this.emitChange();
|
|
|
- // }
|
|
|
- // });
|
|
|
- this.scaleCmd = false;
|
|
|
|
|
|
- // this.emit("objSizeChanged");
|
|
|
- // this.editor.draw();
|
|
|
+ const history = this.controls.historyCtrl.history;
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+
|
|
|
+ history.record({
|
|
|
+ undo: () => {
|
|
|
+ console.log("undo ");
|
|
|
+
|
|
|
+ this.objContainer?.setPivot(scaleIndex);
|
|
|
+ this.objContainer?.scaleSize(preScale.x, preScale.y);
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+ this.objContainer?.updateCompState();
|
|
|
+
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+ redo: () => {
|
|
|
+ console.log("redo ");
|
|
|
+ this.objContainer?.setPivot(scaleIndex);
|
|
|
+ this.objContainer?.scaleSize(lastScale.x, lastScale.y);
|
|
|
+ this.objContainer?.setPivot(0);
|
|
|
+ this.objContainer?.updateCompState();
|
|
|
+ this.upgateGizmoStyle();
|
|
|
+ this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
+ },
|
|
|
+ } as any);
|
|
|
+ history.submit();
|
|
|
+ this.scaleCmd = false;
|
|
|
}
|
|
|
- // this.emitTransformed = false;
|
|
|
}
|
|
|
}
|