zhangyu 4 yıl önce
ebeveyn
işleme
c5e17abcdc
1 değiştirilmiş dosya ile 16 ekleme ve 29 silme
  1. 16 29
      src/components/mapClass/EditScence.ts

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

@@ -61,15 +61,13 @@ export class EditScence extends SGraphScene {
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
     /** 当前选中焦点ItemList */
-    focusItemList: SGraphItem[] | null = null;
+    focusItemList:SGraphItem[] | null = null;
     /**图例节点 */
     Nodes: any = [];  // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
     /**图例节点 */  // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
     Markers: any = [];
     /**  管线对象 */
     Relations: any = [];
-    /** 是否按下ctrl键 */
-    isDownCtrl: Boolean = false
     _isEditStatus: Boolean = true; // 是否可编辑
     set isEditStatus(bol: Boolean): void {
         this._isEditStatus = bol;
@@ -95,6 +93,7 @@ export class EditScence extends SGraphScene {
     };
     set setlegend(obj: any) {
         this._legend = obj;
+        console.log('aaaaaa', obj)
     }
     /** fid=>item映射,由解析器存入   */
     fidToItem = {}
@@ -131,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 = {
@@ -148,8 +147,6 @@ export class EditScence extends SGraphScene {
      * 增加线段item
      */
     addLine(event: SMouseEvent): boolean {
-        // 创建时要清空所有选中状态
-        this.selectContainer
         const clickItem = this.clickIsItem(event);
         if (clickItem) {
             let centerPoint = clickItem.boundingRect().center();
@@ -390,8 +387,6 @@ export class EditScence extends SGraphScene {
         this.focusItem = item;
         this.cmd = 'choice';
         this.scenceUpdate(this);
-        // 创建图片块后实现回调
-        this.finishCreated(item)
     }
 
     /**
@@ -427,7 +422,6 @@ export class EditScence extends SGraphScene {
         this.focusItem = item;
         this.cmd = 'choice';
         this.scenceUpdate(this);
-        this.finishCreated(item)
     }
 
     /**
@@ -459,6 +453,7 @@ export class EditScence extends SGraphScene {
             },
         }
         const item = new SImageLegendItem(null, LegendData);
+        this.cmd = 'choice';
         item.selectable = true;
         item.moveable = true;
         item.zOrder = ItemOrder.markOrder;
@@ -467,10 +462,6 @@ export class EditScence extends SGraphScene {
         this.grabItem = item;
         this.focusItem = item;
         this.scenceUpdate(this);
-        this.finishCreated(item)
-        if(!this.isDownCtrl){
-             this.cmd = 'choice';
-        }
     }
 
     /**
@@ -539,7 +530,6 @@ export class EditScence extends SGraphScene {
      * @param color string 颜色
      */
     updatedBorderColor(color: string): void {
-        console.log('this.focusItem',this.focusItem)
         if (this.focusItem) {
             if (this.focusItem instanceof SZoneLegendItem || this.focusItem instanceof SSCPZZoneLegendItem || this.focusItem instanceof SFHFQZoneLegendItem) {
                 this.focusItem.strokeColor = new SColor(color);
@@ -684,6 +674,7 @@ export class EditScence extends SGraphScene {
      * @param AttachObjectIds Array
      */
     upadatAttachObjectIds(AttachObjectIds: []): void {
+        console.log('AttachObjectIds',AttachObjectIds)
         if (this.focusItem) {
             this.focusItem.data.AttachObjectIds = AttachObjectIds;
         }
@@ -736,12 +727,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) => {
@@ -839,12 +830,9 @@ export class EditScence extends SGraphScene {
      * 完成事件创建的回调函数
      */
     finishCreated(item: any) {
-        this.cmd = 'choice';
-        this.selectContainer.clear()
+        this.setCmd = 'choice';
+        this.focusItem = item;
         this.selectContainer.toggleItem(item)
-        setTimeout(()=>{
-            this.focusItem = item;
-        })
     }
     ////////////////////////
     //  以下为鼠标键盘操作事件
@@ -938,7 +926,6 @@ export class EditScence extends SGraphScene {
         }
         if (this.grabItem) {
             this.grabItem.onKeyDown(event);
-            // 创建时按esc键取消
             if (event.code == "Escape") {
                 const item = this.grabItem;
                 this.grabItem = null
@@ -949,13 +936,13 @@ export class EditScence extends SGraphScene {
                 this.setCmd = 'choice'
             }
         }
-        //delete键删除item
-        if (event.code == "Delete") {
-            this.deleiteItem()
-        }
+        // if (event.key == "Enter") {
+        //     this.cmd = 0
+        // }
         return false
     }
 
+
     /**
      * 鼠标双击事件
      *
@@ -965,8 +952,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()