refactor(仪表板): 仪表板拖拽定位到第二屏时可以直接拖入第二屏 #11849

This commit is contained in:
wangjiahao
2025-02-24 16:24:37 +08:00
committed by dataeaseShu
parent 8dfb9904b6
commit 36a70308fe
2 changed files with 7 additions and 6 deletions

View File

@@ -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)
}

View File

@@ -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"
></canvas-core>
</div>
</div>