Przeglądaj źródła

修改点选问题

haojianlong 5 lat temu
rodzic
commit
0fb04b1efa
2 zmienionych plików z 28 dodań i 1 usunięć
  1. 1 1
      package.json
  2. 27 0
      src/components/mapClass/EditScence.ts

+ 1 - 1
package.json

@@ -9,7 +9,7 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.22",
-    "@saga-web/big": "1.0.54",
+    "@saga-web/big": "1.0.55",
     "@saga-web/draw": "2.1.100",
     "@saga-web/feng-map": "1.0.13",
     "@saga-web/graph": "2.1.94",

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

@@ -320,6 +320,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);
         }
@@ -761,6 +762,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) {
@@ -821,6 +826,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   事件