Browse Source

editer:feat:属性命令使用,undo/redo功能修复

haojianlong 4 years ago
parent
commit
5343891cee

+ 0 - 2
src/components/editClass/edit/items/SBaseRectEdit.ts

@@ -282,8 +282,6 @@ export class SBaseRectEdit extends SGraphEdit {
             this.status = SItemStatus.Normal;
             this.releaseItem();
             this.$emit("finishCreated");
-            this.width = this.boundingRect().width;
-            this.height = this.boundingRect().height;
         }
 
         this.calRect();

+ 4 - 1
src/components/editClass/persagy-edit/PTopoScene.ts

@@ -1,5 +1,5 @@
 import { SBaseEditScene, SBasePipe,SBaseEquipment } from "./../big-edit";
-import { SGraphEdit, } from "./../edit";
+import { SGraphEdit, SGraphPropertyCommand, } from "./../edit";
 import { SMouseEvent } from "@persagy-web/base/lib";
 import { SGraphSelectContainer, SLineStyle } from "@persagy-web/graph";
 import { SItemStatus } from "@persagy-web/big/lib/enums/SItemStatus";
@@ -148,6 +148,9 @@ export class PTopoScene extends SBaseEditScene {
             if (item instanceof SGraphSelectContainer) {
                 return
             }
+            const oldMsg = item[styletype];
+            const newMsg = styleValue;
+            this.undoStack.push(new SGraphPropertyCommand(this, item, styletype, oldMsg, newMsg));
             item[styletype] = styleValue;
         })