提交 239b649b authored 作者: wangjiahao's avatar wangjiahao

refactor: 优化文字组件FontSize值范围设置

上级 0e52dd0d
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</el-tooltip> </el-tooltip>
<div v-if="attrShow('fontSize')" style="width: 70px;float: left;margin-top: 2px;margin-left: 2px;"> <div v-if="attrShow('fontSize')" style="width: 70px;float: left;margin-top: 2px;margin-left: 2px;">
<el-input v-model="styleInfo.fontSize" type="number" size="mini" min="12" max="128" @change="styleChange" /> <el-input v-model="initFontSize" type="number" size="mini" :min="miniFontSize" :max="maxFontSize" @change="styleChange" />
</div> </div>
<el-tooltip v-if="attrShow('fontWeight')" :content="$t('panel.fontWeight')"> <el-tooltip v-if="attrShow('fontWeight')" :content="$t('panel.fontWeight')">
...@@ -169,6 +169,9 @@ export default { ...@@ -169,6 +169,9 @@ export default {
showMain: true, showMain: true,
innerOpacity: 0, innerOpacity: 0,
mainWidthOffset: 600, mainWidthOffset: 600,
initFontSize: 12,
miniFontSize: 12,
maxFontSize: 128,
textAlignOptions: [ textAlignOptions: [
{ {
icon: 'iconfont icon-juzuo', icon: 'iconfont icon-juzuo',
...@@ -285,7 +288,6 @@ export default { ...@@ -285,7 +288,6 @@ export default {
] ]
} }
}, },
computed: { computed: {
boardDivColor() { boardDivColor() {
const style = { const style = {
...@@ -335,6 +337,17 @@ export default { ...@@ -335,6 +337,17 @@ export default {
this.styleInfo['opacity'] = this.innerOpacity / 100 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: { curComponent: {
handler(oldVal, newVal) { handler(oldVal, newVal) {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -346,6 +359,9 @@ export default { ...@@ -346,6 +359,9 @@ export default {
}, },
mounted() { mounted() {
this.init() this.init()
if (this.attrShow('fontSize')) {
this.initFontSize = this.styleInfo.fontSize
}
}, },
methods: { methods: {
...@@ -389,7 +405,12 @@ export default { ...@@ -389,7 +405,12 @@ export default {
getPositionY(y) { getPositionY(y) {
return y * this.curCanvasScale.scalePointHeight return y * this.curCanvasScale.scalePointHeight
}, },
fontSizeChange(val) {
this.styleInfo.fontSize = val
this.styleChange()
},
styleChange() { styleChange() {
console.log('styleChange')
this.$store.commit('recordStyleChange') this.$store.commit('recordStyleChange')
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论