Browse Source

修复墙绘制问题

haojianlong 4 years ago
parent
commit
80528401ca

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

@@ -74,6 +74,22 @@ export class DivideFloorScene extends FloorScene {
     }
 
     /**
+     * 删除墙功能
+    */
+    delWall() {
+        if (this.grabItem && this.grabItem instanceof CustomWall && this.grabItem.status == SItemStatus.Create) {
+            this.deleteItem(this.grabItem);
+            this.grabItem = null;
+        } else if (this.selectContainer.count > 0) {
+            const item = this.selectContainer.itemList[0];
+            if (item instanceof SWallItem || item instanceof CustomWall) {
+                this.deleteItem(item);
+                this.selectContainer.itemList.shift();
+            }
+        }
+    }
+
+    /**
      * 删除墙
     */
     deleteItem(item: SGraphItem) {

+ 3 - 8
src/views/maintain/space/components/spaceGraph.vue

@@ -77,7 +77,7 @@ import {
 import createBSP from "./createBSP";
 import colorArr from "@/utils/graph/config/zoneColor";
 import { SObject } from "@persagy-web/base/lib";
-import { ItemColor } from "@persagy-web/big/lib";
+import { ItemColor, SItemStatus } from "@persagy-web/big/lib";
 import { SSpaceItem } from "@persagy-web/big/lib/items/floor/SSpaceItem";
 import { SZoneItem } from "@persagy-web/big/lib/items/floor/ZoneItem";
 import { AppModule } from "@/store/modules/app";
@@ -668,7 +668,7 @@ export default class spaceGraph extends Vue {
     // 清除切割划分
     clearDivide() {
         // @ts-ignore
-        this.view!.scene.clearCut();
+        this.view.scene.clearCut();
     }
     // 缩放
     scale(val: number) {
@@ -696,12 +696,7 @@ export default class spaceGraph extends Vue {
      */
     clearWall() {
         if (this.scene) {
-            if (this.scene.selectContainer.itemList.length) {
-                const item = this.scene.selectContainer.itemList[0];
-                if (item instanceof SWallItem || item instanceof CustomWall) {
-                    this.scene.deleteItem(item);
-                }
-            }
+            this.scene.delWall();
         }
     }