Browse Source

feat:新增esc删除

YaolongHan 4 years ago
parent
commit
06763d826e
1 changed files with 12 additions and 7 deletions
  1. 12 7
      src/components/mapClass/EditScence.ts

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

@@ -238,15 +238,13 @@ export class EditScence extends SGraphScene {
      */
     addPolygonItem(event: SMouseEvent): void {
         const SubType = this._legend.SubType ? this._legend.SubType : '';
-        //获取信息工程化相关参数
-        const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
         const LegendData: Legend = {
             ID: uuid(),
             Name: this._legend.Name,
             GraphElementType: this._legend.Type,
             Num: 1,
             GraphElementId: this._legend.Id,
-            AttachObjectIds: AttachObjectIds,
+            AttachObjectIds: [],
             Type: "Zone",
             Pos: { X: event.x, Y: event.y },
             OutLine: [{ X: event.x, Y: event.y }],
@@ -294,14 +292,13 @@ export class EditScence extends SGraphScene {
             //@ts-ignore
             item.isExtracted = true
             const SubType = this._legend.SubType ? this._legend.SubType : '';
-            const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
             const LegendData: Legend = {
                 ID: uuid(),
                 Name: this._legend.Name,
                 GraphElementType: this._legend.Type,
                 Num: 1,
                 GraphElementId: this._legend.Id,
-                AttachObjectIds: AttachObjectIds,
+                AttachObjectIds: [],
                 Type: "Zone",
                 Pos: { X: item.x, Y: item.y },
                 OutLine: item.pointArr[0],
@@ -410,14 +407,13 @@ export class EditScence extends SGraphScene {
      */
     addIconItem(event: SMouseEvent): void {
            //获取信息工程化相关参数
-        const AttachObjectIds = this._legend.InfoLocal ? this._legend.InfoLocal : [];
         const LegendData: Legend = {
             ID: uuid(),
             Name: this._legend.Name,
             GraphElementType: this._legend.Type,
             Num: 1,
             GraphElementId: this._legend.Id,
-            AttachObjectIds: AttachObjectIds,
+            AttachObjectIds: [],
             Pos: { X: event.x, Y: event.y },
             Scale: { X: 1, Y: 1, Z: 1 },          // 缩放
             Rolate: { X: 0, Y: 0, Z: 0 },
@@ -842,6 +838,15 @@ export class EditScence extends SGraphScene {
     onKeyDown(event: KeyboardEvent): any {
         if (this.grabItem) {
             this.grabItem.onKeyDown(event);
+            console.log('event',event)
+            if(event.code == "Escape"){
+               const item = this.grabItem;
+               this.grabItem = null
+               this.removeItem(item);
+               if(this.view){
+                   this.view.update()
+               }
+            }
         }
         // if (event.key == "Enter") {
         //     this.cmd = 0