Browse Source

feat:完成相关联动

YaolongHan 4 years ago
parent
commit
ffddf9a899
2 changed files with 13 additions and 3 deletions
  1. 5 1
      src/components/edit/attr_select.vue
  2. 8 2
      src/lib/items/SImgTextItem.ts

+ 5 - 1
src/components/edit/attr_select.vue

@@ -123,7 +123,7 @@
           <a-input-number v-model="fontSize" :min="1" @change="changeFont" style="width: 168px" />
         </div>
         <div class="color-choice">
-          <swatches v-model="color" popover-x="left" />
+          <swatches v-model="color" @close="changeFontColor" popover-x="left" />
         </div>
       </div>
       <!-- 当为设备状态时 -->
@@ -345,6 +345,10 @@ export default {
           newval.itemType == "Image"
         ) {
           this.lengedName = Item.data.Name;
+          if (newval.itemType == "Image") {
+            this.color = Item.color;
+            this.fontSize = Item.font.size;
+          }
         }
       }
     }

+ 8 - 2
src/lib/items/SImgTextItem.ts

@@ -2,7 +2,7 @@ import { SItemStatus } from "@saga-web/big/lib/enums/SItemStatus";
 import { SGraphItem } from '@saga-web/graph/lib/SGraphItem';
 import { STextBaseLine } from '@saga-web/draw/lib';
 import { SMouseEvent } from '@saga-web/base/lib/SMouseEvent';
-import { SSize } from '@saga-web/draw/lib';
+import { SSize, SFont } from '@saga-web/draw/lib';
 import { SPainter } from '@saga-web/draw/lib';
 import { SColor } from '@saga-web/draw/lib';
 import { SRect } from '@saga-web/draw/lib';
@@ -104,7 +104,13 @@ export class SImgTextItem extends SObjectItem {
     this.textItem.color = v;
     this.update();
   }
-
+  get font(): SFont {
+    return this.textItem.font;
+  }
+  set font(v: SFont) {
+    this.textItem.font = v;
+    this.update();
+  }
   /** img Item    */
   img: SImageItem = new SImageItem(this);