Pārlūkot izejas kodu

更新划分区域回车闭合未刷新视图bug;2.0.548

haojianlong 4 gadi atpakaļ
vecāks
revīzija
545703cdad

+ 4 - 4
package-lock.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.537",
+    "version": "2.0.541",
     "lockfileVersion": 1,
     "requires": true,
     "dependencies": {
@@ -38,9 +38,9 @@
             }
         },
         "@saga-web/graphy": {
-            "version": "2.1.40",
-            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/graphy/-/graphy-2.1.40.tgz",
-            "integrity": "sha512-TiUZMl2KcNvMyiQEfkeiBvZH/HnEUPSJCXNA3oFp0PPKwFZbzXWRDhMDa4AzoNxkuPLQaHHhQID/Neti46jNKw==",
+            "version": "2.1.42",
+            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/graphy/-/graphy-2.1.42.tgz",
+            "integrity": "sha512-tzdmEk9WCB1UfoRVkklVHl7p239wMGkxkYNimL3fkJyyZ+WTYPW8lBN/l4eTXUVssP9sUL1d4zOy385hRx9L6Q==",
             "requires": {
                 "@saga-web/draw": "^2.1.75"
             }

+ 2 - 2
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.538",
+    "version": "2.0.548",
     "description": "上格云 CAD图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -33,7 +33,7 @@
     "dependencies": {
         "@saga-web/base": "2.1.9",
         "@saga-web/draw": "2.1.75",
-        "@saga-web/graphy": "2.1.40",
+        "@saga-web/graphy": "2.1.42",
         "axios": "^0.18.0",
         "pako": "^1.0.10",
         "poly-decomp": "^0.3.0",

+ 1 - 1
src/DivideFloorScene.ts

@@ -576,7 +576,7 @@ export class DivideFloorScene extends ZoneScene {
             MinDis: minPointDis,
             Point: Point
         };
-    } // Function absorbSpacePoint()
+    } // Function absorbShadePoint()
 
     /**
      *  吸附遮罩线

+ 1 - 1
src/FloorView.ts

@@ -18,7 +18,7 @@
  * ********************************************************************************************************************
  */
 
-import { SGraphyView } from "@saga-web/graphy/lib";
+import { SGraphyItem, SGraphyView } from "@saga-web/graphy/lib";
 import { SMouseButton, SMouseEvent, SNetUtil } from "@saga-web/base/lib";
 import { SPoint } from "@saga-web/draw/lib";
 

+ 60 - 3
src/items/SceneMarkItem.ts

@@ -26,7 +26,8 @@ import {
     SPainter,
     SPath2D,
     SPoint,
-    SPolygonUtil
+    SPolygonUtil,
+    SRect
 } from "@saga-web/draw/lib";
 import { SMouseEvent } from "@saga-web/base/lib";
 import { ItemOrder } from "../types/ItemOrder";
@@ -42,6 +43,14 @@ export class SceneMarkItem extends SGraphyItem {
     outLine: SPoint[] = [];
     /** 是否闭合    */
     closeFlag = false;
+    /** X坐标最小值  */
+    private minX = Number.MAX_SAFE_INTEGER;
+    /** X坐标最大值  */
+    private maxX = Number.MIN_SAFE_INTEGER;
+    /** Y坐标最小值  */
+    private minY = Number.MAX_SAFE_INTEGER;
+    /** Y坐标最大值  */
+    private maxY = Number.MIN_SAFE_INTEGER;
     /** 鼠标移动点  */
     private lastPoint = new SPoint();
     /** 蒙版       */
@@ -74,9 +83,29 @@ export class SceneMarkItem extends SGraphyItem {
         if (data instanceof Array) {
             this.outLine = data;
             this.createMask();
+            this.outLine.forEach(it => {
+                let x = it.x,
+                    y = it.y;
+                if (x < this.minX) {
+                    this.minX = x;
+                }
+                if (y < this.minY) {
+                    this.minY = y;
+                }
+                if (x > this.maxX) {
+                    this.maxX = x;
+                }
+                if (y > this.maxY) {
+                    this.maxY = y;
+                }
+            });
         } else {
             this.outLine.push(data);
             this.lastPoint = data;
+            this.minY = data.y;
+            this.maxY = data.y;
+            this.minX = data.x;
+            this.maxX = data.x;
         }
         this.zOrder = ItemOrder.sceneMarkOrder;
     } // Constructor
@@ -98,9 +127,23 @@ export class SceneMarkItem extends SGraphyItem {
                 return true;
             }
             let p = new SPoint(event.x, event.y);
-            this.lastPoint.x = p.x;
-            this.lastPoint.y = p.y;
+            let x = p.x,
+                y = p.y;
+            this.lastPoint.x = x;
+            this.lastPoint.y = y;
             this.outLine.push(p);
+            if (x < this.minX) {
+                this.minX = x;
+            }
+            if (y < this.minY) {
+                this.minY = y;
+            }
+            if (x > this.maxX) {
+                this.maxX = x;
+            }
+            if (y > this.maxY) {
+                this.maxY = y;
+            }
         }
         this.update();
         return true;
@@ -153,6 +196,8 @@ export class SceneMarkItem extends SGraphyItem {
         this.closeFlag = true;
         if (this.scene) {
             this.scene.grabItem = null;
+            // @ts-ignore
+            this.scene.isMarking = false;
         }
         this.mask = new SPath2D();
         this.mask.moveTo(Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER);
@@ -171,6 +216,18 @@ export class SceneMarkItem extends SGraphyItem {
     } // Function createMask()
 
     /**
+     * 外接矩阵
+     */
+    boundingRect(): SRect {
+        return new SRect(
+            this.minX,
+            this.minY,
+            this.maxX - this.minX,
+            this.maxY - this.minY
+        );
+    }
+
+    /**
      * 判断点是否在区域内
      *
      * @param x

+ 3 - 0
src/items/ShadeItem.ts

@@ -150,7 +150,10 @@ export class ShadeItem extends SGraphyItem {
         this.closeFlag = true;
         if (this.scene) {
             this.scene.grabItem = null;
+            // @ts-ignore
+            this.scene.isCutting = false;
         }
+        this.update();
     } // Function createMask()
 
     /**

+ 2 - 2
src/types/ItemOrder.ts

@@ -45,11 +45,11 @@ export class ItemOrder {
     /** 遮罩层级    */
     static shadeOrder = 120;
     /** 框选矩形对象层级 */
-    static rectSelectOrder = 999;
+    static rectSelectOrder = 99999;
     /** 高亮对象层级 */
     static highLightOrder = 9999;
     /** 业务空间关系点位层级 */
     static RelationOrder = 9999;
     /** 蒙版层级 */
-    static sceneMarkOrder = Number.MAX_SAFE_INTEGER;
+    static sceneMarkOrder = 99999;
 } // Interface ItemOrder