Explorar o código

SBaseIconTextEdit添加_color和_font私有属性

zhangyu %!s(int64=4) %!d(string=hai) anos
pai
achega
bfd266fb3a
Modificáronse 1 ficheiros con 6 adicións e 11 borrados
  1. 6 11
      persagy-web-edit/src/items/SBaseIconTextEdit.ts

+ 6 - 11
persagy-web-edit/src/items/SBaseIconTextEdit.ts

@@ -230,14 +230,12 @@ export class SBaseIconTextEdit extends SGraphEdit {
     }
 
     /** 文本颜色 */
+    private _color: SColor = new SColor();
     get color(): SColor {
-        if (this.textItemList.length) {
-            return this.textItemList[0].color;
-        } else {
-            return new SColor();
-        }
+        return this._color;
     } // Get color
     set color(v: SColor) {
+        this._color = v;
         this.textItemList.forEach(item => {
             item.color = v;
         })
@@ -245,15 +243,12 @@ export class SBaseIconTextEdit extends SGraphEdit {
     }
 
     /** 文本字体 */
+    private _font: SFont = SFont("sans-serif", 12);
     get font(): SFont {
-        if (this.textItemList.length) {
-            return this.textItemList[0].font
-        } else {
-            return new SFont
-        }
+        return this._font;
     } // Get font
-
     set font(v: SFont) {
+        this._font = v;
         this.textItemList.forEach((item: SBaseTextEdit, index: number) => {
             item.font = v;
             item.moveTo(this.img.width * 0.5, v.size * (index - 0.125 - 0.5 * this.textItemList.length));