Преглед изворни кода

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

haojianlong пре 4 година
родитељ
комит
ee9ae6071f

+ 7 - 1
src/components/baseEditer.vue

@@ -119,9 +119,14 @@ export default {
       bus.$on("itemPositon", (x, y) => {
         this.scene.updatedPosition(Number(x, y));
       });
-      bus.$on("changebackColor", (val) => {
+      bus.$on("changebackColor", val => {
         this.scene.updatedbackColor(val);
       });
+<<<<<<< HEAD
+      bus.$on("deleiteItem", () => {
+        this.scene.deleiteItem();
+      });
+=======
       bus.$on("extractItem", () => {
         const map = {}
         this.fParser.spaceList.forEach(t => {
@@ -143,6 +148,7 @@ export default {
         }
         bus.$emit('exportItem',data)
       })
+>>>>>>> 21575eaae2b540d7cb1e3e4401e1dbc90a7d279a
     }
   },
   watch: {

+ 5 - 45
src/components/edit/leftbar_components/itemTree.vue

@@ -3,11 +3,13 @@
     <div class="tree-body">
       <a-tree
         v-model="checkedKeys"
+        show-checkbox
         checkable
         :expanded-keys="expandedKeys"
         :auto-expand-parent="autoExpandParent"
         :selected-keys="selectedKeys"
         :tree-data="treeData"
+        node-key="id"
         @expand="onExpand"
         @select="onSelect"
       />
@@ -22,49 +24,7 @@
 </template>
 <script>
 import { queryByGroup } from "@/api/editer.js";
-const treeData = [
-  {
-    title: "0-0",
-    key: "0-0",
-    children: [
-      {
-        title: "0-0-0",
-        key: "0-0-0",
-        children: [
-          { title: "0-0-0-0", key: "0-0-0-0" },
-          { title: "0-0-0-1", key: "0-0-0-1" },
-          { title: "0-0-0-2", key: "0-0-0-2" }
-        ]
-      },
-      {
-        title: "0-0-1",
-        key: "0-0-1",
-        children: [
-          { title: "0-0-1-0", key: "0-0-1-0" },
-          { title: "0-0-1-1", key: "0-0-1-1" },
-          { title: "0-0-1-2", key: "0-0-1-2" }
-        ]
-      },
-      {
-        title: "0-0-2",
-        key: "0-0-2"
-      }
-    ]
-  },
-  {
-    title: "0-1",
-    key: "0-1",
-    children: [
-      { title: "0-1-0-0", key: "0-1-0-0" },
-      { title: "0-1-0-1", key: "0-1-0-1" },
-      { title: "0-1-0-2", key: "0-1-0-2" }
-    ]
-  },
-  {
-    title: "0-2",
-    key: "0-2"
-  }
-];
+const treeData = [];
 export default {
   data() {
     return {
@@ -108,13 +68,13 @@ export default {
           const children = this.mapTree(item.Category);
           newTree.push({
             title: item.Name,
-            key: item.Id,
+            id: item.Id,
             children
           });
         } else {
           newTree.push({
             title: item.Name,
-            key: item.Id,
+            id: item.Id,
             children: []
           });
         }

+ 16 - 6
src/components/edit/top_toolbar.vue

@@ -19,7 +19,7 @@
           <span>重做</span>
         </li>-->
         <li>缩放窗口</li>
-        <li>
+        <li @click="alignItem">
           <img class="lock" :src="require(`./../../assets/images/t-format.png`)" alt />
           <span>对齐</span>
         </li>
@@ -39,7 +39,7 @@
           <Icon :name="!isLock?'lock':'unlock'" />
           <span>{{isLock?"锁定":"解锁"}}</span>
         </li>
-        <li>
+        <li @click="deleteItem">
           <a-icon type="delete" />
           <span>删除</span>
         </li>
@@ -50,10 +50,6 @@
         <Icon name="release" />
         <span>发布</span>
       </div>
-      <!--      <div class="btn-list-item">-->
-      <!--        <a-icon type="delete" />-->
-      <!--        <span>下载</span>-->
-      <!--      </div>-->
     </div>
   </div>
 </template>
@@ -90,6 +86,20 @@ export default {
     },
     saveMsg() {
       this.$message.success("保存成功!", 1);
+    },
+    // 删除item
+    deleteItem() {
+      if (this.focusItem) {
+        bus.$emit("deleiteItem");
+        this.focusItem = null;
+        this.$message.success("删除成功", 1);
+      } else {
+        this.$message.error("请选择指定对象!", 1);
+      }
+    },
+    // 对齐item
+    alignItem() {
+
     }
   },
   mounted() {

+ 15 - 7
src/components/mapClass/EditScence.ts

@@ -1,5 +1,5 @@
 import { SMouseEvent, SUndoStack } from "@saga-web/base";
-import { SGraphScene } from '@saga-web/graph/lib';
+import { SGraphScene,SGraphLayoutType } from '@saga-web/graph/lib';
 import { SPoint, SFont } from '@saga-web/draw/lib';
 import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder } from "@saga-web/big";
 import { SGraphItem, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
@@ -39,6 +39,7 @@ export class EditScence extends SGraphScene {
             this.view.update();
         }
     };
+
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
     constructor() {
@@ -46,6 +47,7 @@ export class EditScence extends SGraphScene {
         // // 选择绑定选额item事件
         this.selectContainer.connect("listChange", this, this.listChange);
     }
+
     /**
      * 监听变化
      * @param obj 变化后的对象
@@ -277,7 +279,6 @@ export class EditScence extends SGraphScene {
         if (this.focusItem) {
             this.focusItem.x = x;
             this.focusItem.y = y;
-
         }
     }
 
@@ -286,7 +287,7 @@ export class EditScence extends SGraphScene {
      * 更改item 背景色坐标
      * @param color string 颜色color
      */
-    updatedbackColor(color:string): void {
+    updatedbackColor(color: string): void {
         if (this.focusItem) {
             this.focusItem.backgroundColor = color;
         }
@@ -295,15 +296,22 @@ export class EditScence extends SGraphScene {
     /**
      * 删除指定item
      */
-    deleiteItemStatus(): void {
-
+    deleiteItem(): void {
+        if (this.focusItem) {
+            this.removeItem(this.focusItem);
+            this.focusItem = null;
+        }
+        if (this.view) {
+            this.view.update();
+        }
     }
 
     /**
      * 对齐指定item
+     * @param v
      */
-    alignItem(): void {
-
+    changeAlignItem(v: any): void {
+        this.selectContainer.layout(SGraphLayoutType.v);
     }
 
     /**