From bc50f275c2798d672ca66716b52893bcc9ca1409 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 16 Apr 2024 11:11:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=80=89=E4=B8=AD=E4=B8=80=E4=BA=9B=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8F=AF=E4=BB=A5=E5=9C=A8=E6=B2=A1=E6=9C=89=E7=BB=84?= =?UTF-8?q?=E5=90=88=E6=97=B6=E6=89=B9=E9=87=8F=E5=8F=98=E6=9B=B4=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/Shape.vue | 7 +++-- .../modules/data-visualization/dvMain.ts | 27 ++++++++++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index d35f8a7278..bde1ea4b4c 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -55,7 +55,6 @@
{ isFirst = false } // 修改当前组件样式 - dvMainStore.setShapeStyle(pos, areaData.value.components) + dvMainStore.setShapeStyle(pos, areaData.value.components, 'move') // 等更新完当前组件的样式并绘制到屏幕后再判断是否需要吸附 - // GroupArea是分组视括租金 不需要进行吸附 + // GroupArea是分组视括组件 不需要进行吸附 // 如果不使用 nextTick,吸附后将无法移动 if (!isGroupArea.value) { nextTick(() => { @@ -685,7 +684,7 @@ const handleMouseDownOnPoint = (point, e) => { } calculateRadioComponentPositionAndSize(point, style, symmetricPoint) - dvMainStore.setShapeStyle(style) + dvMainStore.setShapeStyle(style, areaData.value.components, 'resize') // 矩阵逻辑 如果当前是仪表板(矩阵模式)则要进行矩阵重排 dashboardActive.value && emit('onResizing', moveEvent) //如果当前组件是Group分组 则要进行内部组件深度计算 diff --git a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts index 490bcd851e..d3e44a30d1 100644 --- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts +++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts @@ -255,18 +255,31 @@ export const dvMainStore = defineStore('dataVisualization', { this.bashMatrixInfo = bashMatrixInfo }, - setShapeStyle({ top, left, width, height, rotate }, areaDataComponents = []) { + setShapeStyle( + { top, left, width, height, rotate }, + areaDataComponents = [], + moveType = 'move' + ) { if (this.curComponent.component === 'GroupArea' && areaDataComponents.length > 0) { const topOffset = top - this.curComponent.style.top const leftOffset = left - this.curComponent.style.left const widthOffset = width - this.curComponent.style.width const heightOffset = height - this.curComponent.style.height - areaDataComponents.forEach(component => { - component.style.top = component.style.top + topOffset - component.style.left = component.style.left + leftOffset - component.style.width = component.style.width + widthOffset - component.style.height = component.style.height + heightOffset - }) + if (moveType === 'move') { + areaDataComponents.forEach(component => { + component.style.top = component.style.top + topOffset + component.style.left = component.style.left + leftOffset + component.style.width = component.style.width + widthOffset + component.style.height = component.style.height + heightOffset + }) + } else { + areaDataComponents.forEach(component => { + component.style.top = component.style.top + topOffset + component.style.left = component.style.left + leftOffset + component.style.width = component.style.width + widthOffset + component.style.height = component.style.height + heightOffset + }) + } } if (this.dvInfo.type === 'dashboard') { if (top) this.curComponent.style.top = top < 0 ? 0 : Math.round(top)