Selaa lähdekoodia

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

YaolongHan 4 vuotta sitten
vanhempi
commit
389603c7af

+ 2 - 2
package.json

@@ -9,10 +9,10 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.25",
-    "@saga-web/big": "1.0.102",
+    "@saga-web/big": "1.0.105",
     "@saga-web/draw": "2.1.106",
     "@saga-web/feng-map": "1.0.35",
-    "@saga-web/graph": "2.1.119",
+    "@saga-web/graph": "2.1.121",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",
     "element-ui": "^2.13.2",

+ 4 - 0
src/components/baseEditer.vue

@@ -650,6 +650,10 @@ export default {
       bus.$on("toggleItem", item => {
         this.scene.toggleItem(item);
       });
+      // 
+      bus.$on('itemAngle', ang => {
+        this.scene.updateItemAng(ang);
+      })
     },
     // 读取数据
     readGroup() {

+ 24 - 3
src/components/edit/right_toolbar.vue

@@ -57,10 +57,10 @@ const msgList = [
     unit: "y"
   },
   {
-    msg: "0°",
+    msg: "0",
     disable: true,
-    name: "",
-    unit: ""
+    name: "Angle",
+    unit: "°"
   },
   {
     msg: "",
@@ -173,6 +173,16 @@ export default {
           }
         });
         bus.$emit("itemPositon", x, y);
+      } else if (item.name == 'Angle') {
+        if (item.msg.length > 0 && !isNaN(Number(item.msg))) {
+          if (item.msg > 360) {
+            item.msg = 360
+          }
+          if (item.msg < -360) {
+            item.msg = -360
+          }
+          bus.$emit('itemAngle', item.msg)
+        }
       }
     },
     // 点击选中元素
@@ -197,6 +207,9 @@ export default {
           if (item.name == "Height") {
             item.msg = 0;
           }
+          if (item.name == 'Angle') {
+            item.msg = '0'
+          }
         });
         this.aspectRatio = 1;
       } else {
@@ -246,6 +259,14 @@ export default {
             }
             inputH = item.msg;
           }
+          if (item.name == "Angle") {
+            if (Item instanceof SImageLegendItem) {
+              item.disable = false
+            } else {
+              item.disable = true
+            }
+            item.msg = Item.img.rotate
+          }
         });
         this.aspectRatio = inputW / inputH;
       }

+ 24 - 2
src/components/mapClass/EditScence.ts

@@ -753,8 +753,13 @@ export class EditScence extends SGraphScene {
                 let arr = item.data.AttachObjectIds;
                 if (arr && arr.length && arr[arr.length - 1].name) {
                     let name = item.name;
-                    item.name = name + `\n${arr[arr.length - 1].name}`;
-                    item.text = name + `\n${arr[arr.length - 1].name}`;
+                    if (name) {
+                        item.name = name + `\n${arr[arr.length - 1].name}`;
+                        item.text = name + `\n${arr[arr.length - 1].name}`;
+                    } else {
+                        item.name = arr[arr.length - 1].name;
+                        item.text = arr[arr.length - 1].name;
+                    }
                 }
                 // 绑定工程信息化数据后设置状态
                 if (item.data.AttachObjectIds && item.data.AttachObjectIds.length) {
@@ -1852,4 +1857,21 @@ export class EditScence extends SGraphScene {
         this.selectContainer.clear()
         this.selectContainer.toggleItem(item)
     }
+
+    /**
+     * 图标旋转更新角度
+     * 
+     * @param   ang 旋转角度
+    */
+    updateItemAng(ang: number) :void{
+        if (this.focusItem) {
+            if (this.focusItem instanceof SImageLegendItem) {
+                const oldMsg = this.focusItem.img.rotate;
+                const newMsg = ang;
+                this.focusItem.img.rotate = ang;
+                this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem.img, "rotate", oldMsg, newMsg));
+                this.scenceUpdate(this);
+            }
+        }
+    }
 }

+ 17 - 2
src/lib/items/SCustomLegendItem.ts

@@ -5,6 +5,7 @@ import { SPainter, SColor, SFont, SPoint, SLineCapStyle } from "@saga-web/draw";
 import { STextItem } from '@saga-web/graph/lib';
 import { hexify, uuid } from "@/components/mapClass/until"
 import { SItemStatus, ItemOrder, SPolygonItem } from '@saga-web/big/lib';
+import { SMouseEvent } from '@saga-web/base/lib';
 /**
  * 图例节点Item(区域类型)
  *
@@ -93,9 +94,11 @@ export class SCustomLegendItem extends SPolygonItem {
         }
         this._showText = v;
         if (v) {
-            this.textItem.show();
+            this.cursor = "pointer";
+            this.textItem.cursor = "pointer";
         } else {
-            this.textItem.hide();
+            this.cursor = "auto";
+            this.textItem.cursor = "auto";
         }
     }
 
@@ -199,6 +202,18 @@ export class SCustomLegendItem extends SPolygonItem {
         })
     }
 
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == 1)
+        this.$emit("legendItemClick", event);
+        return super.onMouseDown(event);
+    } // Function onMouseDown()
+
     toData(): any {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Name = this.name;

+ 15 - 0
src/lib/items/SFHFQZoneLegendItem.ts

@@ -5,6 +5,7 @@ import { SPainter, SColor, SFont, SPoint, SLineCapStyle } from "@saga-web/draw";
 import { STextItem } from '@saga-web/graph/lib';
 import { hexify, uuid } from "@/components/mapClass/until"
 import { SItemStatus, ItemOrder, SPolygonItem } from '@saga-web/big/lib';
+import { SMouseEvent } from '@saga-web/base/lib';
 /**
  * 图例节点Item(区域类型 --防火分区)
  *
@@ -76,8 +77,10 @@ export class SFHFQZoneLegendItem extends SPolygonItem {
         this._isActive = v;
         if (v) {
             this.cursor = "pointer";
+            this.textItem.cursor = "pointer";
         } else {
             this.cursor = "auto";
+            this.textItem.cursor = "auto";
         }
         this.update();
     } // Set isActive
@@ -198,6 +201,18 @@ export class SFHFQZoneLegendItem extends SPolygonItem {
         })
     }
 
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == 1)
+        this.$emit("legendItemClick", event);
+        return super.onMouseDown(event);
+    } // Function onMouseDown()
+
     toData(): any {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Name = this.name;

+ 16 - 0
src/lib/items/SImageLegendItem.ts

@@ -101,6 +101,9 @@ export class SImageLegendItem extends SIconTextItem {
         if (data.Properties.ImgPos) {
             this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
         }
+        if (data.Properties && data.Properties.ImgRotate) {
+            this.img.rotate = data.Properties.ImgRotate;
+        }
         if (data.Properties && data.Properties.font) {
             this.font = new SFont("sans-serif", data.Properties.font);
         }
@@ -124,6 +127,18 @@ export class SImageLegendItem extends SIconTextItem {
         }
     }
 
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == 1)
+        this.$emit("legendItemClick", event);
+        return super.onMouseDown(event);
+    } // Function onMouseDown()
+
     toData(): Legend {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Size = { Width: this.width, Height: this.height };
@@ -132,6 +147,7 @@ export class SImageLegendItem extends SIconTextItem {
         this.data.Properties.Url = this.img.url;
         this.data.Properties.TextPos = { X: this.textItem.x, Y: this.textItem.y };
         this.data.Properties.ImgPos = { X: this.img.x, Y: this.img.y };
+        this.data.Properties.ImgRotate = this.img.rotate;
         this.data.Properties.Size = {
             Width: this.sWidth,
             Height: this.sHeight

+ 15 - 0
src/lib/items/SSCPZZoneLegendItem.ts

@@ -5,6 +5,7 @@ import { SPainter, SColor, SFont, SPoint, SLineCapStyle } from "@saga-web/draw";
 import { STextItem } from '@saga-web/graph/lib';
 import { hexify, uuid } from "@/components/mapClass/until"
 import { SItemStatus, ItemOrder, SPolygonItem } from '@saga-web/big/lib';
+import { SMouseEvent } from '@saga-web/base/lib';
 /**
  * 图例节点Item(区域类型 --石材铺装)
  *
@@ -76,8 +77,10 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
         this._isActive = v;
         if (v) {
             this.cursor = "pointer";
+            this.textItem.cursor = "pointer";
         } else {
             this.cursor = "auto";
+            this.textItem.cursor = "auto";
         }
         this.update();
     } // Set isActive
@@ -206,6 +209,18 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
         })
     }
 
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == 1)
+        this.$emit("legendItemClick", event);
+        return super.onMouseDown(event);
+    } // Function onMouseDown()
+
     toData(): any {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Name = this.name;

+ 15 - 0
src/lib/items/SZoneLegendItem.ts

@@ -5,6 +5,7 @@ import { SPainter, SColor, SFont, SPoint, SLineCapStyle } from "@saga-web/draw";
 import { STextItem } from '@saga-web/graph/lib';
 import { hexify, uuid } from "@/components/mapClass/until"
 import { SItemStatus, ItemOrder, SPolygonItem } from '@saga-web/big/lib';
+import { SMouseEvent } from '@saga-web/base/lib';
 /**
  * 图例节点Item(区域类型)
  *
@@ -76,8 +77,10 @@ export class SZoneLegendItem extends SPolygonItem {
         this._isActive = v;
         if (v) {
             this.cursor = "pointer";
+            this.textItem.cursor = "pointer";
         } else {
             this.cursor = "auto";
+            this.textItem.cursor = "auto";
         }
         this.update();
     } // Set isActive
@@ -199,6 +202,18 @@ export class SZoneLegendItem extends SPolygonItem {
         })
     }
 
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == 1)
+        this.$emit("legendItemClick", event);
+        return super.onMouseDown(event);
+    } // Function onMouseDown()
+
     toData(): any {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Name = this.name;

+ 13 - 0
src/lib/items/TipelineItem.ts

@@ -5,6 +5,7 @@ import { Relation } from '../types/Relation';
 import { SPoint } from "@saga-web/draw/lib";
 import { Point } from "@saga-web/big/lib/types/Point";
 import { uuid } from '@/components/mapClass/until';
+import { SMouseEvent } from '@saga-web/base/lib';
 
 /**
  * 管道item
@@ -145,6 +146,18 @@ export class TipelineItem extends SPolylineItem {
     }
   }
 
+  /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+      if (event.buttons == 1)
+      this.$emit("legendItemClick", event);
+      return super.onMouseDown(event);
+  } // Function onMouseDown()
+
   /** 获取data数据  */
   toData(): Relation | null {
     let pointList: Point[] = this.pointList.map(item => {