From c0b08dc917e06510cbe9deb55d270cafc2c83d9a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 10 Oct 2024 12:41:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtab=E7=BB=84=E4=BB=B6=E5=86=85=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=E5=9D=90=E6=A0=87=E7=B3=BB=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/custom-component/common/DeRuler.vue | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/custom-component/common/DeRuler.vue b/core/core-frontend/src/custom-component/common/DeRuler.vue index 6fca376555..8316f93ac9 100644 --- a/core/core-frontend/src/custom-component/common/DeRuler.vue +++ b/core/core-frontend/src/custom-component/common/DeRuler.vue @@ -21,7 +21,7 @@ const props = defineProps({ const labelInterval = 5 -const { canvasStyleData, curComponent } = storeToRefs(dvMainStore) +const { canvasStyleData, curComponent, componentData } = storeToRefs(dvMainStore) const rulerSize = computed(() => props.direction === 'horizontal' ? canvasStyleData.value.width : canvasStyleData.value.height @@ -41,13 +41,27 @@ const curComponentSize = computed(() => { } }) +// 计算复合画布内部组件偏移量 +const parentStyle = computed(() => { + const style = { left: 0, top: 0 } + if (curComponent.value && curComponent.value.canvasId !== 'canvas-main') { + componentData.value.forEach(item => { + if (curComponent.value.canvasId.index(item.id) > -1) { + style.left = item.style.left + style.top = item.style.top + } + }) + } + return style +}) + const curComponentShadow = computed(() => { if (curComponent.value) { return { left: (props.direction === 'horizontal' - ? curComponent.value.style.left - : curComponent.value.style.top) + 'px', + ? curComponent.value.style.left + parentStyle.value.left + : curComponent.value.style.top + parentStyle.value.top) + 'px', width: (props.direction === 'horizontal' ? curComponent.value.style.width