YaolongHan 4 năm trước cách đây
mục cha
commit
770d80c1b1
2 tập tin đã thay đổi với 21 bổ sung18 xóa
  1. 0 1
      src/components/edit/right_toolbar.vue
  2. 21 17
      src/components/mapClass/EditScence.ts

+ 0 - 1
src/components/edit/right_toolbar.vue

@@ -177,7 +177,6 @@ export default {
   watch: {
     focusItemList: function(newVal) {
       this.attrType = newVal.itemType;
-      console.log(' this.attrType',newVal)
       if (newVal.itemList.length !== 1) {
         this.msgList.forEach(item => {
           if (item.name == "X") {

+ 21 - 17
src/components/mapClass/EditScence.ts

@@ -44,7 +44,7 @@ export class EditScence extends SGraphScene {
             // 取消操作
             this.focusItem.cancelOperate();
             this.focusItem = null;
-            // this.selectContainer.
+            // this.selectContainer.clear()
         }
         if (this.view) {
             this.view.update();
@@ -61,7 +61,7 @@ export class EditScence extends SGraphScene {
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
     /** 当前选中焦点ItemList */
-    focusItemList:SGraphItem[] | null = null;
+    focusItemList: SGraphItem[] | null = null;
     /**图例节点 */
     Nodes: any = [];  // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
     /**图例节点 */  // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
@@ -130,7 +130,7 @@ export class EditScence extends SGraphScene {
         if (obj.itemList.length == 1) {
             // 获取聚焦item
             this.focusItem = obj.itemList[0]
-        }else{
+        } else {
             this.focusItem = null
         }
         let msg = {
@@ -351,7 +351,6 @@ export class EditScence extends SGraphScene {
             this.addItem(Polylines);
             this.Nodes.push(Polylines);
             Polylines.connect("finishCreated", this, this.finishCreated);
-            this.finishCreated(Polylines)
             this.focusItem = Polylines;
             this.scenceUpdate(this);
         }
@@ -385,7 +384,7 @@ export class EditScence extends SGraphScene {
         this.Markers.push(item);
         this.grabItem == null;
         this.focusItem = item;
-        this.cmd = 'choice';
+        this.finishCreated(item);
         this.scenceUpdate(this);
     }
 
@@ -421,6 +420,7 @@ export class EditScence extends SGraphScene {
         this.grabItem = item;
         this.focusItem = item;
         this.cmd = 'choice';
+        this.finishCreated(item);
         this.scenceUpdate(this);
     }
 
@@ -461,6 +461,7 @@ export class EditScence extends SGraphScene {
         this.Nodes.push(item);
         this.grabItem = item;
         this.focusItem = item;
+        this.finishCreated(item);
         this.scenceUpdate(this);
     }
 
@@ -674,7 +675,7 @@ export class EditScence extends SGraphScene {
      * @param AttachObjectIds Array
      */
     upadatAttachObjectIds(AttachObjectIds: []): void {
-        console.log('AttachObjectIds',AttachObjectIds)
+        console.log('AttachObjectIds', AttachObjectIds)
         if (this.focusItem) {
             this.focusItem.data.AttachObjectIds = AttachObjectIds;
         }
@@ -727,12 +728,12 @@ export class EditScence extends SGraphScene {
                 }
                 this.scenceUpdate(this);
             }
-        }else{
+        } else {
             //批量删除
-            if(!this.focusItemList){
+            if (!this.focusItemList) {
                 return
             }
-            this.focusItemList.forEach((focusItem)=>{
+            this.focusItemList.forEach((focusItem) => {
                 this.removeItem(focusItem);
                 let a = -1
                 this.Nodes.forEach((item: any, index: number) => {
@@ -830,9 +831,12 @@ export class EditScence extends SGraphScene {
      * 完成事件创建的回调函数
      */
     finishCreated(item: any) {
-        this.setCmd = 'choice';
-        this.focusItem = item;
+        this.cmd = 'choice';
+        this.selectContainer.clear()
         this.selectContainer.toggleItem(item)
+        setTimeout(() => {
+            this.focusItem = item;
+        })
     }
     ////////////////////////
     //  以下为鼠标键盘操作事件
@@ -952,8 +956,8 @@ export class EditScence extends SGraphScene {
     onDoubleClick(event: SMouseEvent): boolean {
         if (!this.isEditStatus) {
             return true
-        }else{
-           return super.onDoubleClick(event);
+        } else {
+            return super.onDoubleClick(event);
         }
 
     } // Function onDoubleClick()
@@ -991,7 +995,7 @@ export class EditScence extends SGraphScene {
      * 设置直线结束Item
      *
     */
-   setLineItem(event: SMouseEvent): void {
+    setLineItem(event: SMouseEvent): void {
         if (this.grabItem instanceof SLineMarkerItem) {
             const item = this.clickIsItem(event);
             // 鼠标点是否在某个item内
@@ -1003,7 +1007,7 @@ export class EditScence extends SGraphScene {
                 if (this.grabItem.status == SItemStatus.Create) {
                     // 点击在item内、创建状态且端点列表不为空时将直线结束端点和item绑定
                     if (this.grabItem.line.length) {
-                        if (this.grabItem.startItem?.id == item.id) {
+                        if (this.grabItem.startItem ?.id == item.id) {
                             this.grabItem.endItem = null;
                         } else {
                             this.grabItem.endItem = item;
@@ -1017,7 +1021,7 @@ export class EditScence extends SGraphScene {
                     // 点击在item内、编辑状态且点击的为结束端点时
                     if (this.grabItem.curIndex == 1) {
                         // 直线关联的起始item是直线结束端点所在的item时,不吸附在点击item中心并将直线关联的结束item置为null
-                        if (this.grabItem.startItem?.id == item.id) {
+                        if (this.grabItem.startItem ?.id == item.id) {
                             this.grabItem.endItem = null;
                         } else {// 反正吸附,关联
                             this.grabItem.endItem = item;
@@ -1025,7 +1029,7 @@ export class EditScence extends SGraphScene {
                             item.connect('onMove', this.grabItem, this.grabItem.changePos);
                         }
                     } else if (this.grabItem.curIndex == 0) {
-                        if (this.grabItem.endItem?.id == item.id) {
+                        if (this.grabItem.endItem ?.id == item.id) {
                             this.grabItem.startItem = null;
                         } else {
                             this.grabItem.startItem = item;