|
@@ -169,6 +169,11 @@ export class EditScence extends SGraphScene {
|
|
|
item.connect("finishCreated", this, this.finishCreated);
|
|
|
this.grabItem = item;
|
|
|
this.focusItem = item;
|
|
|
+ // 起始item点
|
|
|
+ item.startItem = clickItem;
|
|
|
+ if (clickItem) {
|
|
|
+ clickItem.connect('onMove', item, item.changePos);
|
|
|
+ }
|
|
|
this.scenceUpdate(this);
|
|
|
// this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
// item.connect("onMove", this, this.onItemMove.bind(this));
|
|
@@ -393,7 +398,7 @@ export class EditScence extends SGraphScene {
|
|
|
Text: '请在右侧属性栏输入文字!',
|
|
|
Color: '',
|
|
|
Font: 12,
|
|
|
- BackgroundColor: ''
|
|
|
+ BackgroundColor: '#f7f9fa'
|
|
|
}
|
|
|
}
|
|
|
const item = new STextMarkerItem(null, data);
|
|
@@ -425,6 +430,7 @@ export class EditScence extends SGraphScene {
|
|
|
Scale: { X: 1, Y: 1, Z: 1 }, // 缩放
|
|
|
Rolate: { X: 0, Y: 0, Z: 0 },
|
|
|
Size: { Width: 0, Height: 0 }, // 大小
|
|
|
+ Type: this._legend.Type,
|
|
|
Properties: {
|
|
|
IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
|
|
|
Url: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
|
|
@@ -792,6 +798,9 @@ export class EditScence extends SGraphScene {
|
|
|
if (this.grabItem instanceof TipelineItem) {
|
|
|
this.setTipeEndanchor(event)
|
|
|
return true;
|
|
|
+ } else if (this.grabItem instanceof SLineMarkerItem && this.grabItem.status == SItemStatus.Create) {
|
|
|
+ this.setLineItem(event)
|
|
|
+ return true;
|
|
|
}
|
|
|
return this.grabItem.onMouseDown(event);
|
|
|
}
|
|
@@ -836,6 +845,17 @@ export class EditScence extends SGraphScene {
|
|
|
return super.onMouseMove(event)
|
|
|
}
|
|
|
|
|
|
+ onMouseUp(event: SMouseEvent): boolean {
|
|
|
+ if (this.grabItem) {
|
|
|
+ if (this.grabItem instanceof SLineMarkerItem && this.grabItem.status == SItemStatus.Edit) {
|
|
|
+ this.setLineItem(event)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return this.grabItem.onMouseUp(event);
|
|
|
+ }
|
|
|
+ return super.onMouseUp(event)
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 键盘事件
|
|
|
*
|
|
@@ -862,7 +882,7 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 设置结束锚点
|
|
|
+ * 设置管线结束锚点
|
|
|
*
|
|
|
*/
|
|
|
setTipeEndanchor(event: SMouseEvent): void {
|
|
@@ -889,6 +909,98 @@ export class EditScence extends SGraphScene {
|
|
|
this.grabItem.onMouseDown(event)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置直线结束Item
|
|
|
+ *
|
|
|
+ */
|
|
|
+ setLineItem(event: SMouseEvent): void {
|
|
|
+ if (this.grabItem instanceof SLineMarkerItem) {
|
|
|
+ const item = this.clickIsItem(event);
|
|
|
+ // 鼠标点是否在某个item内
|
|
|
+ if (item) {
|
|
|
+ let scenePoint = item.boundingRect().center();
|
|
|
+ const p = item.mapToScene(scenePoint.x, scenePoint.y);
|
|
|
+ event.x = p.x;
|
|
|
+ event.y = p.y;
|
|
|
+ if (this.grabItem.status == SItemStatus.Create) {
|
|
|
+ // 点击在item内、创建状态且端点列表不为空时将直线结束端点和item绑定
|
|
|
+ if (this.grabItem.line.length) {
|
|
|
+ this.grabItem.endItem = item;
|
|
|
+ this.grabItem.line[1] = new SPoint(event.x, event.y);
|
|
|
+ item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ }
|
|
|
+ this.grabItem.onMouseDown(event);
|
|
|
+ return
|
|
|
+ } else if (this.grabItem.status == SItemStatus.Edit) {
|
|
|
+ // 点击在item内、编辑状态且点击的为结束端点时
|
|
|
+ if (this.grabItem.curIndex == 1) {
|
|
|
+ // 直线关联的起始item是直线结束端点所在的item时,不吸附在点击item中心并将直线关联的结束item置为null
|
|
|
+ if (this.grabItem.startItem?.id == item.id) {
|
|
|
+ this.grabItem.endItem = null;
|
|
|
+ } else {// 反正吸附,关联
|
|
|
+ this.grabItem.endItem = item;
|
|
|
+ this.grabItem.line[1] = new SPoint(event.x, event.y);
|
|
|
+ item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ }
|
|
|
+ } else if (this.grabItem.curIndex == 0) {
|
|
|
+ if (this.grabItem.endItem?.id == item.id) {
|
|
|
+ this.grabItem.startItem = null;
|
|
|
+ } else {
|
|
|
+ this.grabItem.startItem = item;
|
|
|
+ this.grabItem.line[0] = new SPoint(event.x, event.y);
|
|
|
+ item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果不在item内且点击的是直线的某个端点,将端点的关联item置为null
|
|
|
+ if (this.grabItem.line.length && this.grabItem.curIndex != -1) {
|
|
|
+ if (this.grabItem.curIndex == 1) {
|
|
|
+ this.grabItem.endItem = null;
|
|
|
+ } else if (this.grabItem.curIndex == 0) {
|
|
|
+ this.grabItem.startItem = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (this.grabItem.status == SItemStatus.Create) {
|
|
|
+ // // 鼠标点是否在某个item内
|
|
|
+ // if (item) {
|
|
|
+ // let scenePoint = item.boundingRect().center();
|
|
|
+ // const p = item.mapToScene(scenePoint.x, scenePoint.y);
|
|
|
+ // event.x = p.x;
|
|
|
+ // event.y = p.y;
|
|
|
+ // if (this.grabItem.line.length && this.grabItem.curIndex == -1) {
|
|
|
+ // this.grabItem.endItem = item;
|
|
|
+ // this.grabItem.line[1] = new SPoint(event.x, event.y);
|
|
|
+ // item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ // }
|
|
|
+ // this.grabItem.onMouseDown(event);
|
|
|
+ // return
|
|
|
+ // } else {
|
|
|
+ // if (this.grabItem.line.length && this.grabItem.curIndex != -1) {
|
|
|
+ // if (this.grabItem.curIndex == 1) {
|
|
|
+ // this.grabItem.endItem = null;
|
|
|
+ // } else if (this.grabItem.curIndex == 0) {
|
|
|
+ // this.grabItem.startItem = null;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } else if (this.grabItem.status == SItemStatus.Edit) {
|
|
|
+ // if (this.grabItem.curIndex == 1) {
|
|
|
+ // this.grabItem.endItem = item;
|
|
|
+ // this.grabItem.line[1] = new SPoint(event.x, event.y);
|
|
|
+ // item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ // } else if (this.grabItem.curIndex == 0) {
|
|
|
+ // this.grabItem.startItem = item;
|
|
|
+ // this.grabItem.line[0] = new SPoint(event.x, event.y);
|
|
|
+ // item.connect('onMove', this.grabItem, this.grabItem.changePos);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.grabItem.onMouseUp(event);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 划线时点击位置是否是锚点
|