|
@@ -1,5 +1,5 @@
|
|
|
import { SMouseEvent, SUndoStack } from "@saga-web/base";
|
|
|
-import { SGraphScene,SGraphyItem } from '@saga-web/graph/lib';
|
|
|
+import { SGraphScene, SGraphyItem } from '@saga-web/graph/lib';
|
|
|
import { SPoint } from '@saga-web/draw/lib';
|
|
|
import { SFloorParser, SImageItem, STextItem, SLineItem, SPolylineItem } from "@saga-web/big";
|
|
|
import { SGraphItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
|
|
@@ -24,18 +24,17 @@ export class EditScence extends SGraphScene {
|
|
|
set setCmd(cmd: number) {
|
|
|
if (cmd == 0) {
|
|
|
this.grabItem = null;
|
|
|
- this.focusItem = null;
|
|
|
}
|
|
|
this.cmd = cmd;
|
|
|
- if(this.focusItem){
|
|
|
+ if (this.focusItem) {
|
|
|
// 取消操作
|
|
|
this.focusItem.cancelOperate();
|
|
|
this.focusItem = null;
|
|
|
-
|
|
|
}
|
|
|
+ this.view.update();
|
|
|
};
|
|
|
/** 当前选中焦点Item */
|
|
|
- focusItem:SGraphyItem:null = null;
|
|
|
+ focusItem: SGraphyItem: null = null;
|
|
|
|
|
|
constructor() {
|
|
|
super();
|
|
@@ -77,20 +76,28 @@ export class EditScence extends SGraphScene {
|
|
|
Polylines.setPointList = [point];
|
|
|
this.addItem(Polylines);
|
|
|
this.grabItem = Polylines;
|
|
|
- this.focusItem = Polylines
|
|
|
+ this.focusItem = Polylines;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 增加textItem
|
|
|
+ * 增加图片Item
|
|
|
*/
|
|
|
- addImgItem() {
|
|
|
+ addImgItem(event: SMouseEvent) {
|
|
|
+ const url = require('./../../assets/logo.png')
|
|
|
+ const item = new SImageItem(null);
|
|
|
+ item.url = url;
|
|
|
+ item.moveTo(event.x, event.y);
|
|
|
+ this.addItem(item);
|
|
|
+ this.grabItem == null;
|
|
|
+ this.focusItem = item;
|
|
|
+ this.cmd = 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 增加管道
|
|
|
*/
|
|
|
addTextItem(event: SMouseEvent): void {
|
|
|
- const item = new STextItem(null, '请在右侧属性栏输入文字!');
|
|
|
+ const item = new STextItem(null, '请在右侧属性栏输入文字!');
|
|
|
item.moveTo(event.x, event.y);
|
|
|
this.addItem(item);
|
|
|
this.grabItem == null
|
|
@@ -141,7 +148,6 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
redo(): void {
|
|
|
this.undoStack.undo();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -165,7 +171,8 @@ export class EditScence extends SGraphScene {
|
|
|
this.addTextItem(event);
|
|
|
break;
|
|
|
case 3:
|
|
|
- this.addPolygonItem(event);
|
|
|
+ this.addImgItem(event)
|
|
|
+ // this.addPolygonItem(event);
|
|
|
break;
|
|
|
default:
|
|
|
return super.onMouseDown(event);
|