|
@@ -954,6 +954,9 @@ export class EditScence extends SGraphScene {
|
|
|
if (this.grabItem instanceof SLineMarkerItem && this.grabItem.status == SItemStatus.Edit) {
|
|
|
this.setLineItem(event)
|
|
|
return true;
|
|
|
+ } else if (this.grabItem instanceof TipelineItem){
|
|
|
+ this.updateTipeAnc(event);
|
|
|
+ return true;
|
|
|
}
|
|
|
return this.grabItem.onMouseUp(event);
|
|
|
}
|
|
@@ -1010,13 +1013,13 @@ export class EditScence extends SGraphScene {
|
|
|
*/
|
|
|
setTipeEndanchor(event: SMouseEvent): void {
|
|
|
if (this.grabItem instanceof TipelineItem) {
|
|
|
- if (this.grabItem.status == SItemStatus.Create) {
|
|
|
- const anc = this.clickIsAnchor(event);
|
|
|
- if (anc) {
|
|
|
- const p = anc.mapToScene(0, 0)
|
|
|
- anc.isConnected = true;
|
|
|
- event.x = p.x;
|
|
|
- event.y = p.y;
|
|
|
+ const anc = this.clickIsAnchor(event);
|
|
|
+ if (anc) {
|
|
|
+ const p = anc.mapToScene(0, 0)
|
|
|
+ anc.isConnected = true;
|
|
|
+ event.x = p.x;
|
|
|
+ event.y = p.y;
|
|
|
+ if (this.grabItem.status == SItemStatus.Create) {
|
|
|
if (this.grabItem.pointList.length) {
|
|
|
this.grabItem.endAnchor = anc;
|
|
|
anc.parent ?.connect('changePos', this.grabItem, this.grabItem.changePos)
|
|
@@ -1034,6 +1037,70 @@ export class EditScence extends SGraphScene {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 管线item修改锚点
|
|
|
+ *
|
|
|
+ */
|
|
|
+ updateTipeAnc(event: SMouseEvent): void {
|
|
|
+ if (this.grabItem instanceof TipelineItem){
|
|
|
+ const anc = this.clickIsAnchor(event);
|
|
|
+ if (anc) {
|
|
|
+ const p = anc.mapToScene(0, 0)
|
|
|
+ event.x = p.x;
|
|
|
+ event.y = p.y;
|
|
|
+ if (this.grabItem.status == SItemStatus.Edit) {
|
|
|
+ if (this.grabItem.curIndex == 0) {
|
|
|
+ if (this.grabItem.startAnchor){
|
|
|
+ this.grabItem.startAnchor.isConnected = false
|
|
|
+ this.grabItem.startAnchor.parent.disconnect('changePos',this.grabItem);
|
|
|
+ }
|
|
|
+ anc.isConnected = true;
|
|
|
+ this.grabItem.startAnchor = anc;
|
|
|
+ this.grabItem.anchor1ID = anc.id
|
|
|
+ this.grabItem.node1Id = anc.parent.id
|
|
|
+ anc.parent.connect('changePos', this.grabItem, this.grabItem.changePos)
|
|
|
+ }
|
|
|
+ if (this.grabItem.curIndex == this.grabItem.pointList.length-1) {
|
|
|
+ if (this.grabItem.endAnchor){
|
|
|
+ this.grabItem.endAnchor.isConnected = false
|
|
|
+ this.grabItem.endAnchor.parent.disconnect('changePos',this.grabItem);
|
|
|
+ }
|
|
|
+ anc.isConnected = true;
|
|
|
+ this.grabItem.endAnchor = anc;
|
|
|
+ this.grabItem.anchor2ID = anc.id
|
|
|
+ this.grabItem.node2Id = anc.parent.id
|
|
|
+ anc.parent.connect('changePos', this.grabItem, this.grabItem.changePos)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.grabItem.onMouseUp(event)
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ if (this.grabItem.status == SItemStatus.Edit) {
|
|
|
+ if (this.grabItem.curIndex == 0) {
|
|
|
+ if (this.grabItem.startAnchor){
|
|
|
+ this.grabItem.startAnchor.isConnected = false
|
|
|
+ this.grabItem.startAnchor.parent.disconnect('changePos',this.grabItem);
|
|
|
+ this.grabItem.startAnchor = null;
|
|
|
+ this.grabItem.anchor1ID = ''
|
|
|
+ this.grabItem.node1Id = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.grabItem.curIndex == this.grabItem.pointList.length-1) {
|
|
|
+ if (this.grabItem.endAnchor){
|
|
|
+ this.grabItem.endAnchor.isConnected = false
|
|
|
+ this.grabItem.endAnchor.parent.disconnect('changePos',this.grabItem);
|
|
|
+ this.grabItem.endAnchor = null;
|
|
|
+ this.grabItem.anchor2ID = ''
|
|
|
+ this.grabItem.node2Id = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.grabItem.onMouseUp(event)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 设置直线结束Item
|
|
|
*
|
|
|
*/
|