Selaa lähdekoodia

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

zhangyu 4 vuotta sitten
vanhempi
commit
ccc94c8ff4
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 27 0
      src/components/mapClass/EditScence.ts

+ 27 - 0
src/components/mapClass/EditScence.ts

@@ -321,6 +321,7 @@ export class EditScence extends SGraphScene {
             this.addItem(Polylines);
             this.Nodes.push(Polylines);
             Polylines.connect("finishCreated", this, this.finishCreated);
+            this.finishCreated(Polylines)
             this.focusItem = Polylines;
             this.scenceUpdate(this);
         }
@@ -762,6 +763,10 @@ export class EditScence extends SGraphScene {
             event.y = this.highLight.point.y;
         }
         if (this.grabItem) {
+            // if (this.grabItem instanceof TipelineItem) {
+            //     this.setTipeEndanchor(event)
+            //     return true;
+            // }
             return this.grabItem.onMouseDown(event);
         }
         switch (this.cmd) {
@@ -822,6 +827,28 @@ export class EditScence extends SGraphScene {
     }
 
     /**
+     * 设置结束锚点
+     * 
+    */
+    setTipeEndanchor(event: SMouseEvent): void {
+        if (this.grabItem instanceof TipelineItem) {
+            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.pointList.length) {
+                    this.grabItem.endAnchor = anc;
+                    anc.parent?.connect('changePos', this.grabItem, this.grabItem.changePos)
+                }
+                this.grabItem.status = SItemStatus.Normal;
+            }
+            this.grabItem.onMouseDown(event)
+        }
+    }
+
+    /**
      *  划线时点击位置是否是锚点
      *
      *  @param  event   事件