Pārlūkot izejas kodu

'添加删除点操作'

zhangyu 4 gadi atpakaļ
vecāks
revīzija
78cf772260

+ 1 - 1
src/components/edit/top_toolbar.vue

@@ -160,7 +160,7 @@ export default {
       console.log(this.focusItem);
       if (this.focusItem) {
         bus.$emit("deleiteItem");
-        this.focusItem = null;
+        // this.focusItem = null;
         this.$message.success("删除成功", 1);
       } else {
         this.$message.error("请选择指定对象!", 1);

+ 39 - 30
src/components/mapClass/EditScence.ts

@@ -1,6 +1,6 @@
 import { SMouseEvent, SUndoStack } from "@saga-web/base";
 import { SGraphScene, SGraphLayoutType } from '@saga-web/graph/lib';
-import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder } from "@saga-web/big";
+import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder, STooltipItem } from "@saga-web/big";
 import { SGraphItem, SLineStyle, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
 import { SZoneLegendItem } from "@/lib/items/SZoneLegendItem";
 import { SSCPZZoneLegendItem } from "@/lib/items/SSCPZZoneLegendItem";
@@ -613,40 +613,49 @@ export class EditScence extends SGraphScene {
      */
     deleiteItem(): void {
         if (this.focusItem) {
-            this.removeItem(this.focusItem);
-            let a = -1
-            this.Nodes.forEach((item: any, index: number) => {
-                if (item.id == this.focusItem.id) {
-                    a = index
+            if ((this.focusItem instanceof SZoneLegendItem ||
+                this.focusItem instanceof SSCPZZoneLegendItem ||
+                this.focusItem instanceof SFHFQZoneLegendItem ||
+                this.focusItem instanceof TipelineItem) &&
+                this.focusItem.curIndex != -1
+            ) {
+                this.focusItem.deletePoint(this.focusItem.curIndex);
+            } else {
+                this.removeItem(this.focusItem);
+                let a = -1
+                this.Nodes.forEach((item: any, index: number) => {
+                    if (item.id == this.focusItem.id) {
+                        a = index
+                    }
+                });
+                if(a > -1) {
+                    this.Nodes.splice(a, 1);
                 }
-            });
-            if(a > -1) {
-                this.Nodes.splice(a, 1);
-            }
-            let b = -1;
-            this.Markers.forEach((item: any, index: number) => {
-                if (item.id == this.focusItem.id) {
-                    b = index
+                let b = -1;
+                this.Markers.forEach((item: any, index: number) => {
+                    if (item.id == this.focusItem.id) {
+                        b = index
+                    }
+                });
+                if (b > -1) {
+                    this.Markers.splice(b, 1);
                 }
-            });
-            if (b > -1) {
-                this.Markers.splice(b, 1);
-            }
-            let c = -1;
-            this.Relations.forEach((item: any, index: number) => {
-                if (item.id == this.focusItem.id) {
-                    c = index
+                let c = -1;
+                this.Relations.forEach((item: any, index: number) => {
+                    if (item.id == this.focusItem.id) {
+                        c = index
+                    }
+                });
+                if (c > -1) {
+                    this.Relations.splice(c, 1);
                 }
-            });
-            if (c > -1) {
-                this.Relations.splice(c, 1);
+                this.focusItem = null;
+                if (this.view) {
+                    this.view.update();
+                }
+                this.scenceUpdate(this);
             }
-            this.focusItem = null;
         }
-        if (this.view) {
-            this.view.update();
-        }
-        this.scenceUpdate(this);
     }
     scenceUpdate(scence: any) {}