From 486fd0f60545c07f653182fbbb72f97f293cda61 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 17 Sep 2021 10:51:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=8B=96=E6=8B=BD=E9=98=B4=E5=BD=B1=E8=B7=9F=E9=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 22 ++++++++++++++----- frontend/src/components/DeDrag/shadow.vue | 2 +- .../canvas/components/Editor/index.vue | 4 ++-- frontend/src/store/index.js | 8 ++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 17feeae9fd..9c31fc37b3 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -510,11 +510,13 @@ export default { width: this.computedMainSlotWidth, height: this.computedMainSlotHeight } - console.log('style=>' + JSON.stringify(style)) + // console.log('style=>' + JSON.stringify(style)) return style }, + curComponent() { + return this.$store.state.curComponent + }, ...mapState([ - 'curComponent', 'editor', 'curCanvasScale', 'canvasStyleData', @@ -614,6 +616,18 @@ export default { this.beforeDestroyFunction() this.createdFunction() this.mountedFunction() + }, + // private 监控dragging resizing + dragging(val) { + if (this.enabled) { + this.curComponent.optStatus.dragging = val + } + }, + // private 监控dragging resizing + resizing(val) { + if (this.enabled) { + this.curComponent.optStatus.resizing = val + } } }, created: function() { @@ -1572,10 +1586,6 @@ export default { addEvent(document.documentElement, 'touchend touchcancel', this.deselect) // 窗口变化时,检查容器大小 addEvent(window, 'resize', this.checkParentSize) - - // private 记录当前组件的操作状态 - this.curComponent.optStatus.resizing = this.resizing - this.curComponent.optStatus.dragging = this.dragging }, createdFunction() { // minWidth不能大于maxWidth diff --git a/frontend/src/components/DeDrag/shadow.vue b/frontend/src/components/DeDrag/shadow.vue index e35a5376ce..e0a1d9993a 100644 --- a/frontend/src/components/DeDrag/shadow.vue +++ b/frontend/src/components/DeDrag/shadow.vue @@ -28,7 +28,7 @@ export default { background: 'gray', position: 'absolute' } - console.log('style=>' + JSON.stringify(style)) + // console.log('style=>' + JSON.stringify(style)) return style }, ...mapState([ diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index c14151c562..00fe06832b 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -12,7 +12,7 @@ @mousedown="handleMouseDown" > - + @@ -636,7 +636,7 @@ export default { }, resizeView(index, item) { if (item.type === 'view') { - console.log('view:resizeView') + // console.log('view:resizeView') this.$refs.wrapperChild[index].chartResize() } } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index b11a051fd8..4fa489018c 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -87,9 +87,11 @@ const data = { setCurComponent(state, { component, index }) { // 当前视图操作状态置空 - component['optStatus'] = { - dragging: false, - resizing: false + if (component) { + component['optStatus'] = { + dragging: false, + resizing: false + } } state.styleChangeTimes = 0 state.curComponent = component