From 239b649bcaf8c6488f466d11b23b998f163c99fb Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 31 Dec 2021 11:27:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E5=AD=97=E7=BB=84=E4=BB=B6FontSize=E5=80=BC=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/components/TextAttr.vue | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/canvas/components/TextAttr.vue b/frontend/src/components/canvas/components/TextAttr.vue index 30d6284ad0..68b3822a67 100644 --- a/frontend/src/components/canvas/components/TextAttr.vue +++ b/frontend/src/components/canvas/components/TextAttr.vue @@ -51,7 +51,7 @@
- +
@@ -169,6 +169,9 @@ export default { showMain: true, innerOpacity: 0, mainWidthOffset: 600, + initFontSize: 12, + miniFontSize: 12, + maxFontSize: 128, textAlignOptions: [ { icon: 'iconfont icon-juzuo', @@ -285,7 +288,6 @@ export default { ] } }, - computed: { boardDivColor() { const style = { @@ -335,6 +337,17 @@ export default { this.styleInfo['opacity'] = this.innerOpacity / 100 } }, + initFontSize: { + handler(newVal) { + if (newVal < this.miniFontSize) { + this.styleInfo.fontSize = this.miniFontSize + } else if (newVal > this.maxFontSize) { + this.styleInfo.fontSize = this.maxFontSize + } else { + this.styleInfo.fontSize = newVal + } + } + }, curComponent: { handler(oldVal, newVal) { this.$nextTick(() => { @@ -346,6 +359,9 @@ export default { }, mounted() { this.init() + if (this.attrShow('fontSize')) { + this.initFontSize = this.styleInfo.fontSize + } }, methods: { @@ -389,7 +405,12 @@ export default { getPositionY(y) { return y * this.curCanvasScale.scalePointHeight }, + fontSizeChange(val) { + this.styleInfo.fontSize = val + this.styleChange() + }, styleChange() { + console.log('styleChange') this.$store.commit('recordStyleChange') } }