|
@@ -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));
|