diff --git a/src/components/draw-app/properties/ButtonProperty.vue b/src/components/draw-app/properties/ButtonProperty.vue
index 29c5f7e..26effbf 100644
--- a/src/components/draw-app/properties/ButtonProperty.vue
+++ b/src/components/draw-app/properties/ButtonProperty.vue
@@ -17,6 +17,30 @@
lazy-rules
:rules="[(val) => val >= 0 || '宽度必须大于等于0']"
/>
+
+
+
+
+ {
+ buttonModel.codeColor = val;
+ onUpdate();
+ }
+ "
+ />
+
+
+
+
diff --git a/src/graphics/button/Button.ts b/src/graphics/button/Button.ts
index 5139b37..5d18d87 100644
--- a/src/graphics/button/Button.ts
+++ b/src/graphics/button/Button.ts
@@ -31,6 +31,7 @@ export const buttonConsts = {
radius: 2,
fillColor: '0x1976D2',
alpha: 1,
+ codeColor: '#000',
codeFontSize: 16,
};
@@ -125,10 +126,11 @@ export class Button extends JlGraphic {
}
if (this.datas.code) {
- this.setTextGraphic(this.labelGraphic, 'label');
this.labelGraphic.text = this.datas.code;
this.datas.codeFontSize =
this.datas.codeFontSize || buttonConsts.codeFontSize;
+ this.datas.codeColor = this.datas.codeColor || buttonConsts.codeColor;
+ this.setTextGraphic(this.labelGraphic, 'label');
const labelPosition = this.datas.childTransforms?.find(
(t) => t.name === this.labelGraphic.name
)?.transform.position;
@@ -162,10 +164,10 @@ export class Button extends JlGraphic {
}
setTextGraphic(g: VectorText, name: string) {
- const fontSize = this.datas.codeFontSize || buttonConsts.codeFontSize;
+ const fontSize = this.datas.codeFontSize;
g.setVectorFontSize(fontSize);
g.anchor.set(0.5);
- g.style.fill = '#000';
+ g.style.fill = this.datas.codeColor;
g.transformSave = true;
g.name = name;
}