瀏覽代碼

'修改文本属性'

zhangyu 4 年之前
父節點
當前提交
cc1a33d60b
共有 5 個文件被更改,包括 457 次插入478 次删除
  1. 430 410
      package-lock.json
  2. 3 3
      package.json
  3. 16 3
      src/components/edit/attr_select.vue
  4. 3 3
      src/components/mapClass/EditScence.ts
  5. 5 59
      src/lib/items/STextMarkerItem.ts

文件差異過大導致無法顯示
+ 430 - 410
package-lock.json


+ 3 - 3
package.json

@@ -8,9 +8,9 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@saga-web/base": "2.1.21",
-    "@saga-web/big": "1.0.46",
-    "@saga-web/draw": "2.1.97",
+    "@saga-web/base": "2.1.22",
+    "@saga-web/big": "1.0.48",
+    "@saga-web/draw": "2.1.98",
     "@saga-web/feng-map": "1.0.11",
     "@saga-web/graph": "2.1.90",
     "@saga-web/topology": "1.0.84",

+ 16 - 3
src/components/edit/attr_select.vue

@@ -60,7 +60,7 @@
       <div class="row">
         <div class="row-tit">背景色</div>
         <div class="color-choice">
-          <swatches v-model="backColor" popover-x="left" @close="changebackColor" />
+          <swatches v-model="backColor" :swatches="swatches" popover-x="left" @close="changebackColor" />
         </div>
       </div>
     </div>
@@ -356,6 +356,19 @@ export default {
         Zone: "编辑区域"
       },
       swatchess: ["#69C5FC", "#656EDF", "#58AF6F", "#2D8FAA"],
+      swatches: [
+          "#00000000",
+          "#1FBC9C",
+          "#1CA085",
+          "#2ECC70",
+          "#27AF60",
+          "#3398DB",
+          "#2980B9",
+          "#A463BF",
+          "#8E43AD",
+          "#3D556E",
+          "#222F3D",
+      ],
       lengedName: "", // 图例名称
       imageNum: 1, //设备数量
       fillColor: "", //修改填充色 (主要针对防火风区以及石材铺装)
@@ -459,8 +472,8 @@ export default {
         if (newval.itemType == "baseText") {
           this.textMsg = Item.text;
           this.fontSize = Item.font.size;
-          this.fontColor = Item.color;
-          this.backColor = Item.backgroundColor;
+          this.fontColor = Item.color.value;
+          this.backColor = Item.backgroundColor.value;
         } else if (newval.itemType == "baseLine") {
           this.lineWidth = Item.lineWidth;
           this.borderColor = Item.strokeColor;

+ 3 - 3
src/components/mapClass/EditScence.ts

@@ -350,7 +350,7 @@ export class EditScence extends SGraphScene {
                 IconUrl: require(`../../assets/images/t-text-hover.png`),
                 Text: '请在右侧属性栏输入文字!',
                 Color: '',
-                Font: 0,
+                Font: 12,
                 BackgroundColor: ''
             }
         }
@@ -459,7 +459,7 @@ export class EditScence extends SGraphScene {
     updatedFontColor(color: string): void {
         if (this.focusItem) {
             let old = this.focusItem.color;
-            this.focusItem.color = color;
+            this.focusItem.color = new SColor(color);
             // this.undoStack.push(new SGraphPropertyCommand(this, this.focusItem, "color", old, color));
         }
     }
@@ -536,7 +536,7 @@ export class EditScence extends SGraphScene {
      */
     updatedbackColor(color: string): void {
         if (this.focusItem) {
-            this.focusItem.backgroundColor = color;
+            this.focusItem.backgroundColor = new SColor(color);
         }
     }
 

+ 5 - 59
src/lib/items/STextMarkerItem.ts

@@ -12,25 +12,6 @@ export class STextMarkerItem extends STextItem {
     /** 标识对象数据 */
     data: Marker;
 
-    /** 边框宽度 */
-    private _lineWidth: number = 1;
-    get lineWidth(): number {
-        return this._lineWidth;
-    }
-    set lineWidth(v: number) {
-        this._lineWidth = v;
-        this.update();
-    }
-
-    /** 边框样式    */
-    private _borderStyle: SLineStyle = SLineStyle.None;
-    get borderStyle(): SLineStyle {
-        return this._borderStyle;
-    }
-    set borderStyle(v: SLineStyle) {
-        this._borderStyle = v;
-        this.update();
-    }
     /**
      * 构造函数
      *
@@ -52,13 +33,13 @@ export class STextMarkerItem extends STextItem {
             this.text = data.Properties.Text;
         }
         if (data.Properties && data.Properties.Color) {
-            this.color = data.Properties.Color
+            this.color = new SColor(data.Properties.Color);
         }
         if (data.Properties && data.Properties.Font) {
             this.font = new SFont("sans-serif", data.Properties.Font);;
         }
         if (data.Properties && data.Properties.BackgroundColor) {
-            this.backgroundColor = data.Properties.BackgroundColor
+            this.backgroundColor = new SColor(data.Properties.BackgroundColor);
         }
     } // Constructor
 
@@ -66,44 +47,9 @@ export class STextMarkerItem extends STextItem {
         this.data.Pos = {X: this.x, Y: this.y};
         this.data.Size = {Width: this.width, Height: this.height};
         this.data.Properties.Text = this.text;
-        this.data.Properties.Color = this.color;
-        this.data.Properties.Font = this.font.size
-        this.data.Properties.BackgroundColor = this.backgroundColor
+        this.data.Properties.Color = this.color.value;
+        this.data.Properties.Font = this.font.size;
+        this.data.Properties.BackgroundColor = this.backgroundColor.value;
         return this.data;
     }
-
-    /**
-     * Item绘制操作
-     *
-     * @param   painter      绘画类
-     */
-    onDraw(painter: SPainter): void {
-        // 绘制文本
-        painter.brush.color = new SColor(this.color);
-        painter.font = this.font;
-        this.drawFormatText(painter);
-        if (this.selected) {
-            this.borderStyle = SLineStyle.Dashed;
-        } else {
-            this.borderStyle = SLineStyle.None;
-        }
-        if (this.borderStyle == SLineStyle.Dashed) {
-            painter.pen.lineDash = [
-                painter.toPx(this.lineWidth * 3),
-                painter.toPx(this.lineWidth * 7)
-            ];
-            painter.brush.color = SColor.Transparent;
-            painter.drawRect(this.boundingRect());
-        } else if (this.borderStyle == SLineStyle.Dotted) {
-            painter.pen.lineDash = [
-                painter.toPx(this.lineWidth),
-                painter.toPx(this.lineWidth)
-            ];
-            painter.brush.color = SColor.Transparent;
-            painter.drawRect(this.boundingRect());
-        } else if (this.borderStyle == SLineStyle.Soild) {
-            painter.brush.color = SColor.Transparent;
-            painter.drawRect(this.boundingRect());
-        }
-    } // Function onDraw()
 } // Class STextMarkerItem