|
@@ -12,8 +12,8 @@
|
|
|
<script lang="ts">
|
|
|
import { SMouseEvent, SUndoStack } from "@saga-web/base";
|
|
|
import { SColor, SPainter, SRect, SFont, STextBaseLine } from "@saga-web/draw";
|
|
|
- import { SGraphyItem, SGraphyScene, SGraphyView } from "@saga-web/graphy";
|
|
|
- import { SGraphyCommand } from "@saga-web/graphy/lib";
|
|
|
+ import { SGraphyItem, SGraphyScene, SGraphyView } from "@saga-web/graph";
|
|
|
+ import { SGraphyCommand } from "@saga-web/graph/lib";
|
|
|
import { SUndoCommand } from "@saga-web/base/lib";
|
|
|
import { SPoint } from "@saga-web/draw/lib";
|
|
|
|
|
@@ -135,6 +135,11 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 属性修改命令类
|
|
|
+ *
|
|
|
+ * @author 张宇(taohuzy@163.com)
|
|
|
+ */
|
|
|
class SGraphyPropertyCommand<T> extends SGraphyCommand {
|
|
|
item: SGraphyItem;
|
|
|
/** 属性名称 */
|
|
@@ -144,6 +149,15 @@
|
|
|
/** 属性新值 */
|
|
|
newProp: T;
|
|
|
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @param scene 命令所属的场景类
|
|
|
+ * @param item 命令所属的item类
|
|
|
+ * @param propName 修改的属性名称
|
|
|
+ * @param oldProp 修改前的属性值
|
|
|
+ * @param newProp 修改后的属性值
|
|
|
+ */
|
|
|
constructor(scene: SGraphyScene, item: SGraphyItem, propName: string, oldProp: T, newProp: T) {
|
|
|
super(scene);
|
|
|
this.item = item;
|
|
@@ -152,11 +166,17 @@
|
|
|
this.newProp = newProp;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * redo操作
|
|
|
+ */
|
|
|
redo(): void {
|
|
|
this.item[this.propName] = this.newProp;
|
|
|
this.item.update();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * undo操作
|
|
|
+ */
|
|
|
undo(): void {
|
|
|
this.item[this.propName] = this.oldProp;
|
|
|
this.item.update();
|