Pārlūkot izejas kodu

'添加区域复制'

zhangyu 4 gadi atpakaļ
vecāks
revīzija
cff21d22e9
1 mainītis faili ar 30 papildinājumiem un 29 dzēšanām
  1. 30 29
      src/components/mapClass/EditScence.ts

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

@@ -1229,21 +1229,22 @@ export class EditScence extends SGraphScene {
         const parserData = new STopologyParser(null);
         // 需要深拷贝
         parserData.parseData(JSON.parse(JSON.stringify(this.copyString)))
-        // 不需要复制区域
-        // parserData.zoneLegendList.forEach(t => {
-        //     if (t instanceof SCustomLegendItem) {
-        //         if (this.view) {
-        //             t.pos.x += 10 / this.view.scale
-        //             t.pos.y += 10 / this.view.scale
-        //         }
-        //         this.addItem(t)
-        //         this.Nodes.push(t);
-        //         graphItemList.push(t)
-        //     }
-        //  // 加到node
-        //  // 加命令
-        // })
         const graphItemList = [];
+        // 不需要复制区域
+        parserData.zoneLegendList.forEach(t => {
+            // if (t instanceof SCustomLegendItem) {
+                if (this.view) {
+                    t.pos.x += 10 / this.view.scale
+                    t.pos.y += 10 / this.view.scale
+                }
+                t.moveable = true;
+                this.addItem(t)
+                this.Nodes.push(t);
+                graphItemList.push(t)
+            // }
+         // 加到node
+         // 加命令
+        })
         parserData.imageLegendList.forEach(t => {
             if (this.view) {
                 t.pos.x += 10 / this.view.scale
@@ -1309,25 +1310,25 @@ export class EditScence extends SGraphScene {
         try {
             console.log(crossPageString);
             const pageObj = JSON.parse(crossPageString)
-
             const parserData = new STopologyParser(null);
+            const graphItemList = [];
             // 需要深拷贝
             parserData.parseData(JSON.parse(JSON.stringify(pageObj)))
             // 不需要复制区域
-            // parserData.zoneLegendList.forEach(t => {
-            //     if (t instanceof SCustomLegendItem) {
-            //         if (this.view) {
-            //             t.pos.x += 10 / this.view.scale
-            //             t.pos.y += 10 / this.view.scale
-            //         }
-            //         this.addItem(t)
-            //         this.Nodes.push(t);
-            //         graphItemList.push(t)
-            //     }
-            //  // 加到node
-            //  // 加命令
-            // })
-            const graphItemList = [];
+            parserData.zoneLegendList.forEach(t => {
+                // if (t instanceof SCustomLegendItem) {
+                    if (this.view) {
+                        t.pos.x += 10 / this.view.scale
+                        t.pos.y += 10 / this.view.scale
+                    }
+                    t.moveable = true;
+                    this.addItem(t)
+                    this.Nodes.push(t);
+                    graphItemList.push(t)
+                // }
+             // 加到node
+             // 加命令
+            })
             parserData.imageLegendList.forEach(t => {
                 if (this.view) {
                     t.pos.x += 10 / this.view.scale