Jelajahi Sumber

框选问题修改

haojianlong 4 tahun lalu
induk
melakukan
c2aab9d67a
1 mengubah file dengan 16 tambahan dan 1 penghapusan
  1. 16 1
      src/components/mapClass/EditScence.ts

+ 16 - 1
src/components/mapClass/EditScence.ts

@@ -2033,7 +2033,22 @@ export class EditScence extends SGraphScene {
             this.selectContainer.clear()
         }
         if (this.grabItem instanceof SRectSelectItem) {
-            const rect = this.grabItem.boundingRect();
+            let left,top,w,h;
+            if(this.grabItem.startPoint.x < this.grabItem.endPoint.x) {
+                left = this.grabItem.startPoint.x;
+                w = this.grabItem.endPoint.x - this.grabItem.startPoint.x
+            } else {
+                left = this.grabItem.endPoint.x
+                w = this.grabItem.startPoint.x - this.grabItem.endPoint.x
+            }
+            if (this.grabItem.startPoint.y < this.grabItem.endPoint.y) {
+                top = this.grabItem.startPoint.y;
+                h = this.grabItem.endPoint.y - this.grabItem.startPoint.y
+            } else {
+                top = this.grabItem.endPoint.y;
+                h = this.grabItem.startPoint.y - this.grabItem.endPoint.y
+            }
+            const rect = new SRect(left,top,w,h);
             this.arrToSelect(this.Nodes, rect)
             this.arrToSelect(this.Markers, rect)
             this.arrToSelect(this.Relations, rect)