Merge pull request #4990 from damianstasik/autopan-fix
fix(system): ensure auto-pan stops when state changes during drag
This commit is contained in:
5
.changeset/serious-ducks-care.md
Normal file
5
.changeset/serious-ducks-care.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/system': patch
|
||||
---
|
||||
|
||||
Make it possible to stop autoPanOnDrag by setting it to false
|
||||
@@ -214,7 +214,13 @@ export function XYDrag<OnNodeDrag extends (e: any, nodes: any, node: any) => voi
|
||||
return;
|
||||
}
|
||||
|
||||
const { transform, panBy, autoPanSpeed } = getStoreItems();
|
||||
const { transform, panBy, autoPanSpeed, autoPanOnNodeDrag } = getStoreItems();
|
||||
|
||||
if (!autoPanOnNodeDrag) {
|
||||
autoPanStarted = false;
|
||||
cancelAnimationFrame(autoPanId);
|
||||
return;
|
||||
}
|
||||
|
||||
const [xMovement, yMovement] = calcAutoPan(mousePosition, containerBounds, autoPanSpeed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user