variable autoPanSpeed
This commit is contained in:
@@ -44,6 +44,7 @@ function onPointerDown(
|
||||
updateConnection,
|
||||
getTransform,
|
||||
getFromHandle,
|
||||
autoPanSpeed,
|
||||
}: OnPointerDownParams
|
||||
) {
|
||||
// when xyflow is used inside a shadow root we can't use document
|
||||
@@ -78,7 +79,8 @@ function onPointerDown(
|
||||
if (!autoPanOnConnect || !containerBounds) {
|
||||
return;
|
||||
}
|
||||
const [x, y] = calcAutoPan(position, containerBounds);
|
||||
const transform = getTransform();
|
||||
const [x, y] = calcAutoPan(position, containerBounds, transform, autoPanSpeed);
|
||||
|
||||
panBy({ x, y });
|
||||
autoPanId = requestAnimationFrame(autoPan);
|
||||
|
||||
@@ -35,6 +35,7 @@ export type OnPointerDownParams = {
|
||||
onReconnectEnd?: (evt: MouseEvent | TouchEvent) => void;
|
||||
getTransform: () => Transform;
|
||||
getFromHandle: () => Handle | null;
|
||||
autoPanSpeed?: number;
|
||||
};
|
||||
|
||||
export type IsValidParams = {
|
||||
|
||||
Reference in New Issue
Block a user