mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
refactor: move gap adaptor tab
This commit is contained in:
@@ -809,9 +809,15 @@ function checkStartMove() {
|
||||
if (cloneItem && nowItemNode) {
|
||||
const xGap = Math.abs(cloneItem.offsetLeft - nowItemNode.offsetLeft)
|
||||
const yGap = Math.abs(cloneItem.offsetTop - nowItemNode.offsetTop)
|
||||
return xGap > offsetX || yGap > offsetY
|
||||
return {
|
||||
xMove: xGap > offsetX,
|
||||
yMove: yGap > offsetY,
|
||||
}
|
||||
}
|
||||
return {
|
||||
xMove: false,
|
||||
yMove: false,
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function startMove(e: MouseEvent, item: CanvasItem, index: number) {
|
||||
@@ -933,13 +939,10 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
|
||||
|
||||
//If the current canvas is locked, no component movement will be performed
|
||||
if (canvasLocked.value) return
|
||||
if (!checkStartMove()) {
|
||||
return
|
||||
}
|
||||
|
||||
const { xMove, yMove } = checkStartMove()
|
||||
// Adjust the accuracy of moving coordinate changes
|
||||
let newX = Math.round(nowCloneItemX / cellWidth.value)
|
||||
let newY = Math.round(nowCloneItemY / cellHeight.value)
|
||||
let newX = xMove ? Math.round(nowCloneItemX / cellWidth.value) : infoBox.value.oldX
|
||||
let newY = yMove ? Math.round(nowCloneItemY / cellHeight.value) : infoBox.value.oldY
|
||||
newX = newX > 0 ? newX : 1
|
||||
newY = newY > 0 ? newY : 1
|
||||
debounce(() => {
|
||||
|
||||
Reference in New Issue
Block a user