From 36a70308fedcbca334b44363b88625e209bd7190 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 24 Feb 2025 16:24:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E6=9D=BF=E6=8B=96=E6=8B=BD=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=88=B0=E7=AC=AC=E4=BA=8C=E5=B1=8F=E6=97=B6=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=8B=96=E5=85=A5=E7=AC=AC=E4=BA=8C=E5=B1=8F?= =?UTF-8?q?=20#11849?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/data-visualization/canvas/CanvasCore.vue | 9 +++++---- core/core-frontend/src/views/canvas/DeCanvas.vue | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index 104ca43bfe..73f85fdb13 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -54,10 +54,10 @@ const dvMainStore = dvMainStoreWithOut() const composeStore = composeStoreWithOut() const contextmenuStore = contextmenuStoreWithOut() -const { curComponent, dvInfo, editMode, tabMoveOutComponentId, canvasState } = +const { curComponent, dvInfo, editMode, tabMoveOutComponentId, canvasState, mainScrollTop } = storeToRefs(dvMainStore) const { editorMap, areaData, isCtrlOrCmdDown } = storeToRefs(composeStore) -const emits = defineEmits(['scrollCanvasToTop']) +const emits = defineEmits(['scrollCanvasAdjust']) const props = defineProps({ themes: { type: String, @@ -1377,7 +1377,8 @@ const handleDragStartMoveIn = componentInfo => { adaptCurThemeCommonStyle(moveInItemInfo) } addItemBox(moveInItemInfo) - emits('scrollCanvasToTop') + // 直接定位到当前画布位置 + // emits('scrollCanvasAdjust', 1) if (!infoBox.value) { infoBox.value = {} } @@ -1400,7 +1401,7 @@ const handleDragOver = e => { return } infoBox.value.moveItem.style.left = e.pageX - infoBox.value.moveItem.style.top = e.pageY + infoBox.value.moveItem.style.top = e.pageY + mainScrollTop.value onDragging(e, infoBox.value.moveItem, 0) } diff --git a/core/core-frontend/src/views/canvas/DeCanvas.vue b/core/core-frontend/src/views/canvas/DeCanvas.vue index 303970ffe4..ac48c6030f 100644 --- a/core/core-frontend/src/views/canvas/DeCanvas.vue +++ b/core/core-frontend/src/views/canvas/DeCanvas.vue @@ -271,7 +271,7 @@ const getBaseMatrixSize = () => { } } -const scrollTo = y => { +const scrollTo = (y = 1) => { setTimeout(() => { canvasInner.value.scrollTo({ top: (y - 1) * baseHeight.value, @@ -334,7 +334,7 @@ defineExpose({ :base-width="baseWidth" :base-height="baseHeight" :font-family="fontFamily" - @scrollCanvasToTop="scrollTo(1)" + @scrollCanvasAdjust="scrollTo" >