feat(core): add autoPanSpeed prop (#1535)
* feat(core): add `autoPanSpeed` prop * chore(changeset): add
This commit is contained in:
@@ -46,6 +46,7 @@ export function useDrag(params: UseDragParams) {
|
||||
nodeDragThreshold,
|
||||
viewport,
|
||||
autoPanOnNodeDrag,
|
||||
autoPanSpeed,
|
||||
nodesDraggable,
|
||||
panBy,
|
||||
findNode,
|
||||
@@ -132,7 +133,7 @@ export function useDrag(params: UseDragParams) {
|
||||
return
|
||||
}
|
||||
|
||||
const [xMovement, yMovement] = calcAutoPan(mousePosition, containerBounds)
|
||||
const [xMovement, yMovement] = calcAutoPan(mousePosition, containerBounds, autoPanSpeed.value)
|
||||
|
||||
if (xMovement !== 0 || yMovement !== 0) {
|
||||
const nextPos = {
|
||||
|
||||
@@ -56,6 +56,7 @@ export function useHandle({
|
||||
connectionClickStartHandle,
|
||||
nodesConnectable,
|
||||
autoPanOnConnect,
|
||||
autoPanSpeed,
|
||||
findNode,
|
||||
panBy,
|
||||
startConnection,
|
||||
@@ -120,7 +121,7 @@ export function useHandle({
|
||||
return
|
||||
}
|
||||
|
||||
const [xMovement, yMovement] = calcAutoPan(connectionPosition, containerBounds)
|
||||
const [xMovement, yMovement] = calcAutoPan(connectionPosition, containerBounds, autoPanSpeed.value)
|
||||
|
||||
panBy({ x: xMovement, y: yMovement })
|
||||
autoPanId = requestAnimationFrame(autoPan)
|
||||
|
||||
Reference in New Issue
Block a user