From 773f54d2823775279ca482ff1db6ec9cf48f55fc Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 30 Nov 2022 14:05:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E7=B2=BE=E7=A1=AE=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=99=90=E5=80=BC=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/view/PositionAdjust.vue | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/chart/view/PositionAdjust.vue b/frontend/src/views/chart/view/PositionAdjust.vue index 37023bb46c..b2377909ac 100644 --- a/frontend/src/views/chart/view/PositionAdjust.vue +++ b/frontend/src/views/chart/view/PositionAdjust.vue @@ -14,7 +14,9 @@ v-model="styleInfo.top" type="number" :min="0" + :max="maxTop" class="hide-icon-number" + @change="topOnChange" > @@ -44,8 +46,11 @@ > @@ -59,7 +64,10 @@ @@ -77,12 +85,18 @@ export default { name: 'PositionAdjust', props: {}, data() { - return {} + return { + maxHeight: 2000, + maxTop: 40000 + } }, computed: { maxLeft() { return 1600 - this.styleInfo.width - this.componentGap }, + maxWidth() { + return 1600 - this.styleInfo.left - this.componentGap + }, styleInfo() { return this.$store.state.curComponent.style }, @@ -97,7 +111,34 @@ export default { leftOnChange() { if (this.styleInfo.left > this.maxLeft) { this.styleInfo.left = this.maxLeft + } else if (this.styleInfo.left < 0) { + this.styleInfo.left = 0 } + this.$store.commit('canvasChange') + }, + widthOnChange() { + if (this.styleInfo.width > this.maxWidth) { + this.styleInfo.width = this.maxWidth + } else if (this.styleInfo.width < 0) { + this.styleInfo.left = 0 + } + this.$store.commit('canvasChange') + }, + heightOnChange() { + if (this.styleInfo.height > this.maxHeight) { + this.styleInfo.height = this.maxHeight + } else if (this.styleInfo.height < 0) { + this.styleInfo.height = 0 + } + this.$store.commit('canvasChange') + }, + topOnChange() { + if (this.styleInfo.top > this.maxTop) { + this.styleInfo.top = this.maxTop + } else if (this.styleInfo.top < 0) { + this.styleInfo.top = 0 + } + this.$store.commit('canvasChange') } } }