Browse Source

修改画墙bug

haojianlong 4 years ago
parent
commit
4b46729111
3 changed files with 18 additions and 4 deletions
  1. 2 1
      src/utils/graph/CustomWall.ts
  2. 1 0
      src/utils/graph/DivideFloorScene.ts
  3. 15 3
      src/utils/graph/generate.ts

+ 2 - 1
src/utils/graph/CustomWall.ts

@@ -1,5 +1,5 @@
 import { SKeyCode, SMouseEvent, SUndoStack } from "@persagy-web/base/lib";
-import { SItemStatus } from "@persagy-web/big/lib";
+import { ItemOrder, SItemStatus } from "@persagy-web/big/lib";
 import { SMathUtil } from "@persagy-web/big/lib/utils/SMathUtil";
 import { SColor, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/lib";
 import { SGraphItem, SGraphPointListDelete, SGraphPointListInsert, SGraphPointListUpdate, SGraphStyleItem, SLineStyle } from "@persagy-web/graph/lib";
@@ -71,6 +71,7 @@ import { SGraphItem, SGraphPointListDelete, SGraphPointListInsert, SGraphPointLi
         }
         this.fillColor = new SColor("#2196f3");
         this.selectable = true;
+        this.zOrder = ItemOrder.wallOrder
     } // Constructor
     
     /**

+ 1 - 0
src/utils/graph/DivideFloorScene.ts

@@ -69,6 +69,7 @@ export class DivideFloorScene extends FloorScene {
                 this.removeItem(t)
             })
             this.customWall = []
+            this.grabItem = null;
         }
     }
 

+ 15 - 3
src/utils/graph/generate.ts

@@ -1,6 +1,6 @@
 import { SPoint } from "@persagy-web/draw/lib";
 // @ts-ignore
-import { intersect, polygon, segments, combine, selectUnion, selectDifference, selectDifferenceRev} from "polybooljs";
+import { intersect, polygon, segments, combine, selectUnion, selectDifference, selectDifferenceRev } from "polybooljs";
 
 export class generate {
     /**
@@ -10,8 +10,9 @@ export class generate {
      * @param p2 第二个点 也是2条线的交点
      * @param p3 第三个点
      * @param l  距离2条线的距离
+     * @return number Array(4) 两个点
     */
-    static getBisector(p1: SPoint, p2: SPoint, p3: SPoint, l: number) {
+    static getBisector(p1: SPoint, p2: SPoint, p3: SPoint, l: number): [number, number, number, number] {
         const dy1 = p1.y - p2.y;
         const dx1 = p1.x - p2.x;
 
@@ -53,8 +54,9 @@ export class generate {
      * @param p1 点1
      * @param p2 点2
      * @param l  距离这条线的距离
+     * @return number Array(4) 两个点
     */
-    static getVertical(p1: SPoint, p2: SPoint, l: number) {
+    static getVertical(p1: SPoint, p2: SPoint, l: number): [number, number, number, number] {
         const dy1 = p1.y - p2.y;
         const dx1 = p1.x - p2.x;
 
@@ -108,6 +110,16 @@ export class generate {
         return null;
     }
 
+    /**
+     * 一条线生成的4个点,根据这4个点和这条线,将轮廓线排序
+     * 
+     * @param [number, number, number, number]
+     * @param [number, number, number, number]
+     * @param SLine
+     * @return 轮廓线数据
+    */
+
+
 
     static llll() {
         const a = {