From 3f4375827f1736de587e16741a2acc9f99414d67 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 16 Sep 2021 16:10:16 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feat:=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=94=B9=E5=8F=98=E5=A4=A7=E7=9F=A9=E9=98=B5=E5=BC=8F?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E9=A2=84=E5=88=A4=E8=A7=86=E5=9B=BE=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E5=B0=BA=E5=AF=B8=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 43 ++++++++++++++++++- .../canvas/components/Editor/index.vue | 7 +-- .../canvas/custom-component/UserView.vue | 2 +- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 1d95915e4c..08b51318b8 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -32,7 +32,9 @@ > - +
+ +
@@ -445,7 +447,7 @@ export default { return { width: this.computedWidth, height: this.computedHeight, - opacity: 0.2, + opacity: 0.4, background: 'gray' } }, @@ -473,7 +475,44 @@ export default { return this.height + 'px' }, + // 根据left right 算出元素的宽度 + computedMainSlotWidth() { + if (this.w === 'auto') { + if (!this.widthTouched) { + return 'auto' + } + } + if (this.canvasStyleData.auxiliaryMatrix) { + const width = Math.round(this.width / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth + return width + 'px' + } else { + return this.width + 'px' + } + }, + // 根据top bottom 算出元素的宽度 + computedMainSlotHeight() { + if (this.h === 'auto') { + if (!this.heightTouched) { + return 'auto' + } + } + if (this.canvasStyleData.auxiliaryMatrix) { + const height = Math.round(this.height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight + return height + 'px' + } else { + return this.height + 'px' + } + }, + // private + mainSlotStyle() { + const style = { + width: this.computedMainSlotWidth, + height: this.computedMainSlotHeight + } + console.log('style=>' + JSON.stringify(style)) + return style + }, ...mapState([ 'curComponent', 'editor', diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index afd486554a..33fc9af320 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" > - + @@ -221,8 +221,8 @@ export default { }, // 矩阵数量 默认 128 * 72 matrixCount: { - x: 80, - y: 45 + x: 36, + y: 18 }, customStyleHistory: null, showDrag: true, @@ -636,6 +636,7 @@ export default { }, resizeView(index, item) { if (item.type === 'view') { + console.log('view:resizeView') this.$refs.wrapperChild[index].chartResize() } } diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 74cf2d3f86..4aa962993b 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -435,7 +435,7 @@ export default { this.$refs[this.element.propValue.id].chartResize() } this.destroyTimeMachine() - }, 200) + }, 50) } }, From e35bb5c692adddffb932217bd2bb124be2055e88 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 16 Sep 2021 18:42:11 +0800 Subject: [PATCH 02/12] =?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 | 6 ++- frontend/src/components/DeDrag/shadow.vue | 47 +++++++++++++++++++ .../canvas/components/Editor/index.vue | 6 +-- frontend/src/store/index.js | 5 ++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/DeDrag/shadow.vue diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 08b51318b8..17feeae9fd 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -52,7 +52,7 @@ import EditBar from '@/components/canvas/components/Editor/EditBar' export default { replace: true, - name: 'VueDragResizeRotate', + name: 'Dedrag', components: { EditBar }, props: { className: { @@ -1572,6 +1572,10 @@ 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 new file mode 100644 index 0000000000..e35a5376ce --- /dev/null +++ b/frontend/src/components/DeDrag/shadow.vue @@ -0,0 +1,47 @@ + + + + diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index 33fc9af320..c14151c562 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -104,9 +104,8 @@ :active="item === curComponent" /> - - + @@ -169,9 +168,10 @@ import { deepCopy } from '@/components/canvas/utils/utils' import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog' import DeOutWidget from '@/components/dataease/DeOutWidget' import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar' +import DragShadow from '@/components/DeDrag/shadow' export default { - components: { Shape, ContextMenu, MarkLine, Area, Grid, DeDrag, UserViewDialog, DeOutWidget, CanvasOptBar }, + components: { Shape, ContextMenu, MarkLine, Area, Grid, DeDrag, UserViewDialog, DeOutWidget, CanvasOptBar, DragShadow }, props: { isEdit: { type: Boolean, diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index ae045bcd1c..b11a051fd8 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -86,6 +86,11 @@ const data = { }, setCurComponent(state, { component, index }) { + // 当前视图操作状态置空 + component['optStatus'] = { + dragging: false, + resizing: false + } state.styleChangeTimes = 0 state.curComponent = component state.curComponentIndex = index 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 03/12] =?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 From 24589b12aa3254591fce2729a39a01abfa444aff Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 17 Sep 2021 11:25:15 +0800 Subject: [PATCH 04/12] =?UTF-8?q?refactor:=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E7=9F=A9=E5=BD=A2=EF=BC=8C=E6=96=87=E5=AD=97=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E9=97=B4=E9=9A=99=E7=AD=89=E9=BB=98=E8=AE=A4=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 6 +++++- .../canvas/components/Editor/ComponentWrapper.vue | 2 +- .../components/canvas/components/Editor/Preview.vue | 2 +- .../src/components/canvas/components/Editor/index.vue | 3 +-- .../canvas/custom-component/component-list.js | 10 +++++----- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 9c31fc37b3..5828cae258 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -32,7 +32,7 @@ > -
+
@@ -1712,6 +1712,10 @@ export default { opacity: 0.5; } +.gap_class{ + padding:5px; +} + /*.mouseOn >>> .icon-shezhi{*/ /* z-index: 2;*/ /* display:block!important;*/ diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index 51bc67d471..508622ff35 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -127,7 +127,7 @@ export default { box-shadow:0px 0px 7px #0a7be0; } .gap_class{ - padding:3px; + padding:5px; } .component-custom { outline: none; diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index e73b426c00..1a36d8fc36 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -259,7 +259,7 @@ export default { color: #9ea6b2; } .gap_class{ - padding:3px; + padding:5px; } .dialog-css>>>.el-dialog__title { font-size: 14px; diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index 00fe06832b..eb7655680a 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -32,7 +32,6 @@ :active="item === curComponent" :element="item" class-name-active="de-drag-active" - :class="{'gap_class':canvasStyleData.panel.gap==='yes'}" :snap="true" :snap-tolerance="2" :change-style="customStyle" @@ -671,7 +670,7 @@ export default { } .gap_class{ - padding:3px; + padding:5px; } // 拖拽组件样式 diff --git a/frontend/src/components/canvas/custom-component/component-list.js b/frontend/src/components/canvas/custom-component/component-list.js index 9a3ecfd7fc..391d1590ba 100644 --- a/frontend/src/components/canvas/custom-component/component-list.js +++ b/frontend/src/components/canvas/custom-component/component-list.js @@ -51,9 +51,9 @@ const list = [ icon: 'wenben', type: 'v-text', style: { - width: 300, + width: 400, height: 100, - fontSize: 18, + fontSize: 22, fontWeight: 400, lineHeight: '', letterSpacing: 0, @@ -120,10 +120,10 @@ const list = [ icon: 'juxing', type: 'rect-shape', style: { - width: 200, - height: 200, + width: 400, + height: 300, borderStyle: 'solid', - borderWidth: 1, + borderWidth: 0, borderColor: '#000000', backgroundColor: '#ffffff', borderRadius: 0 From 26e2110434fea42148d176b0ce36bb436131306f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 17 Sep 2021 17:48:58 +0800 Subject: [PATCH 05/12] =?UTF-8?q?refactor:=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E7=9F=A9=E5=BD=A2=EF=BC=8C=E6=96=87=E5=AD=97=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E9=97=B4=E9=9A=99=E7=AD=89=E9=BB=98=E8=AE=A4=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/DeDrag/MoveInShadow.vue | 69 +++++++++++++++++++ frontend/src/components/DeDrag/shadow.vue | 2 +- .../canvas/components/Editor/index.vue | 2 +- frontend/src/store/index.js | 10 ++- frontend/src/views/panel/ViewSelect/index.vue | 2 + frontend/src/views/panel/edit/index.vue | 2 + 6 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/DeDrag/MoveInShadow.vue diff --git a/frontend/src/components/DeDrag/MoveInShadow.vue b/frontend/src/components/DeDrag/MoveInShadow.vue new file mode 100644 index 0000000000..366436c3aa --- /dev/null +++ b/frontend/src/components/DeDrag/MoveInShadow.vue @@ -0,0 +1,69 @@ + + + + diff --git a/frontend/src/components/DeDrag/shadow.vue b/frontend/src/components/DeDrag/shadow.vue index e0a1d9993a..f4c7796496 100644 --- a/frontend/src/components/DeDrag/shadow.vue +++ b/frontend/src/components/DeDrag/shadow.vue @@ -1,5 +1,5 @@