|
@@ -1,7 +1,7 @@
|
|
|
import { SMouseEvent, SUndoStack } from "@saga-web/base";
|
|
|
import { SGraphScene, SGraphLayoutType, SAnchorItem } from '@saga-web/graph/lib';
|
|
|
import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder, STooltipItem, ItemColor } from "@saga-web/big";
|
|
|
-import { SGraphItem, SLineStyle, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
|
|
|
+import { SGraphItem, SLineStyle,SGraphPropertyCommand, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
|
|
|
import { SZoneLegendItem } from "@/lib/items/SZoneLegendItem";
|
|
|
import { SSCPZZoneLegendItem } from "@/lib/items/SSCPZZoneLegendItem";
|
|
|
import { SFHFQZoneLegendItem } from "@/lib/items/SFHFQZoneLegendItem";
|
|
@@ -185,7 +185,6 @@ export class EditScence extends SGraphScene {
|
|
|
clickItem.connect('onMove', item, item.changePos);
|
|
|
}
|
|
|
this.scenceUpdate(this);
|
|
|
- // this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
// item.connect("onMove", this, this.onItemMove.bind(this));
|
|
|
return true
|
|
|
}
|
|
@@ -202,7 +201,6 @@ export class EditScence extends SGraphScene {
|
|
|
item.zOrder = ItemOrder.polylineOrder
|
|
|
this.addItem(item);
|
|
|
item.connect("finishCreated", this, this.finishCreated);
|
|
|
- // this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
this.grabItem = item;
|
|
|
this.focusItem = item;
|
|
|
return true
|
|
@@ -241,7 +239,6 @@ export class EditScence extends SGraphScene {
|
|
|
this.addItem(item);
|
|
|
this.Relations.push(item);
|
|
|
item.connect("finishCreated", this, this.finishCreated);
|
|
|
- // this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
this.grabItem = item;
|
|
|
this.focusItem = item;
|
|
|
// 起始锚点
|
|
@@ -478,10 +475,11 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
updatedText(str: string): void {
|
|
|
if (this.focusItem) {
|
|
|
- const old = this.focusItem.text;
|
|
|
+ const oldMsg = this.focusItem.text;
|
|
|
+ const newMsg = str;
|
|
|
this.focusItem.text = str;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", oldMsg, newMsg));
|
|
|
this.scenceUpdate(this);
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", old, str));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -495,8 +493,7 @@ export class EditScence extends SGraphScene {
|
|
|
let font = new SFont(this.focusItem.font);
|
|
|
font.size = size;
|
|
|
this.focusItem.font = font;
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "font", old, font));
|
|
|
-
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "font", old, font));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -506,11 +503,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
updatedLineWidth(lineWidth: number): void {
|
|
|
if (this.focusItem) {
|
|
|
- // let old = new SFont(this.focusItem.font);
|
|
|
- // let font = new SFont(this.focusItem.font);
|
|
|
- // font.size = size;
|
|
|
+ const oldMsg = this.focusItem.lineWidth;
|
|
|
+ const newMsg = lineWidth;
|
|
|
this.focusItem.lineWidth = lineWidth;
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "font", old, font));
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "lineWidth", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -520,9 +516,11 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
updatedFontColor(color: string): void {
|
|
|
if (this.focusItem) {
|
|
|
- let old = this.focusItem.color;
|
|
|
- this.focusItem.color = new SColor(color);
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
|
|
|
+ const oldMsg = this.focusItem.color;
|
|
|
+ const newMsg = new SColor(color);
|
|
|
+
|
|
|
+ this.focusItem.color = newMsg;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -532,13 +530,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
updatedBorderColor(color: string): void {
|
|
|
if (this.focusItem) {
|
|
|
- if (this.focusItem instanceof SZoneLegendItem || this.focusItem instanceof SSCPZZoneLegendItem || this.focusItem instanceof SFHFQZoneLegendItem) {
|
|
|
- this.focusItem.strokeColor = new SColor(color);
|
|
|
- } else {
|
|
|
- // let old = this.focusItem.strokeColor;
|
|
|
- this.focusItem.strokeColor = new SColor(color);
|
|
|
- }
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
|
|
|
+ const oldMsg = this.focusItem.strokeColor;
|
|
|
+ const newMsg = new SColor(color);
|
|
|
+ this.focusItem.strokeColor = newMsg;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "strokeColor", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -549,13 +544,17 @@ export class EditScence extends SGraphScene {
|
|
|
|
|
|
updatedWidth(width: number): void {
|
|
|
if (this.focusItem) {
|
|
|
- // let old = this.focusItem.width;
|
|
|
+ let oldMsg = null;
|
|
|
+ const newMsg = width;
|
|
|
if (this.focusItem.data && this.focusItem.data.GraphElementType && this.focusItem.data.GraphElementType == "Image") {
|
|
|
+ oldMsg = this.focusItem.sWidth
|
|
|
this.focusItem.sWidth = width;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "sWidth", oldMsg, newMsg));
|
|
|
} else {
|
|
|
+ oldMsg = this.focusItem.width
|
|
|
this.focusItem.width = width;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "width", oldMsg, newMsg));
|
|
|
}
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -566,13 +565,18 @@ export class EditScence extends SGraphScene {
|
|
|
updatedHeight(height: number): void {
|
|
|
|
|
|
if (this.focusItem) {
|
|
|
- // let old = this.focusItem.width;
|
|
|
+ let oldMsg = null;
|
|
|
+ const newMsg = height;
|
|
|
if (this.focusItem.data && this.focusItem.data.GraphElementType && this.focusItem.data.GraphElementType == "Image") {
|
|
|
+ oldMsg = this.focusItem.sHeight;
|
|
|
this.focusItem.sHeight = height;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "sHeight", oldMsg, newMsg));
|
|
|
} else {
|
|
|
+ oldMsg = this.focusItem.height;
|
|
|
this.focusItem.height = height;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "height", oldMsg, newMsg));
|
|
|
}
|
|
|
- // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -598,7 +602,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
updatedbackColor(color: string): void {
|
|
|
if (this.focusItem) {
|
|
|
+ const newMsg = new SColor(color);
|
|
|
+ const oldMsg = this.focusItem.backgroundColor;
|
|
|
this.focusItem.backgroundColor = new SColor(color);
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "backgroundColor", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -608,7 +615,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadataImageUrl(url: string): void {
|
|
|
if (this.focusItem) {
|
|
|
- this.focusItem.url = '/serve/topology-wanda/Picture/query/' + url;
|
|
|
+ const newMsg = '/serve/topology-wanda/Picture/query/' + url;
|
|
|
+ const oldMsg = this.focusItem.url;
|
|
|
+ this.focusItem.url = newMsg;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "url", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -626,7 +636,10 @@ export class EditScence extends SGraphScene {
|
|
|
} else if (val == 'solid') {
|
|
|
borderStyle = SLineStyle.Soild;
|
|
|
}
|
|
|
+ const newMsg = borderStyle;
|
|
|
+ const oldMsg = this.focusItem.lineStyle;
|
|
|
this.focusItem.lineStyle = borderStyle;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "lineStyle", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -636,7 +649,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadataLengedName(val: string): void {
|
|
|
if (this.focusItem && this.focusItem.data) {
|
|
|
+ const newMsg = val;
|
|
|
+ const oldMsg = this.focusItem.text;
|
|
|
this.focusItem.text = val;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "text", oldMsg, newMsg));
|
|
|
this.scenceUpdate(this);
|
|
|
}
|
|
|
}
|
|
@@ -647,7 +663,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadatImageNum(num: number): void {
|
|
|
if (this.focusItem && this.focusItem.num) {
|
|
|
+ const newMsg = num;
|
|
|
+ const oldMsg = this.focusItem.num;
|
|
|
this.focusItem.num = num;
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "num", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -657,7 +676,10 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
upadatfillColor(fillColor: string): void {
|
|
|
if (this.focusItem && this.focusItem.fillColor) {
|
|
|
+ const newMsg = new SColor(fillColor);
|
|
|
+ const oldMsg = this.focusItem.fillColor;
|
|
|
this.focusItem.fillColor = new SColor(fillColor);
|
|
|
+ this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "num", oldMsg, newMsg));
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -773,7 +795,9 @@ export class EditScence extends SGraphScene {
|
|
|
this.scenceUpdate(this);
|
|
|
}
|
|
|
}
|
|
|
- scenceUpdate(scence: any) { }
|
|
|
+ scenceUpdate(scence: any) {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 对齐指定item
|
|
@@ -811,11 +835,6 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
return element
|
|
|
}
|
|
|
- /**
|
|
|
- * 锁住item
|
|
|
- */
|
|
|
- lockItem(): void {
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 执行取消操作
|
|
@@ -837,7 +856,11 @@ export class EditScence extends SGraphScene {
|
|
|
this.cmd = 'choice';
|
|
|
this.selectContainer.clear()
|
|
|
this.selectContainer.toggleItem(item)
|
|
|
- this.focusItem = item;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.focusItem = item;
|
|
|
+ })
|
|
|
+ // 做相应得redo/undo处理
|
|
|
+ this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
}
|
|
|
////////////////////////
|
|
|
// 以下为鼠标键盘操作事件
|