variable autoPanSpeed

This commit is contained in:
peterkogo
2024-07-04 16:33:45 +02:00
parent 0589b89d0e
commit 3f259e9662
10 changed files with 37 additions and 10 deletions
+3 -1
View File
@@ -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);
+1
View File
@@ -35,6 +35,7 @@ export type OnPointerDownParams = {
onReconnectEnd?: (evt: MouseEvent | TouchEvent) => void;
getTransform: () => Transform;
getFromHandle: () => Handle | null;
autoPanSpeed?: number;
};
export type IsValidParams = {