feat(viewport-helpers): return promises

This commit is contained in:
moklick
2024-07-08 13:18:07 +02:00
parent e1d023641b
commit 2503d32a88
15 changed files with 140 additions and 87 deletions
+2 -2
View File
@@ -195,7 +195,7 @@ export function XYDrag<OnNodeDrag extends (e: any, nodes: any, node: any) => voi
}
}
function autoPan() {
async function autoPan() {
if (!containerBounds) {
return;
}
@@ -208,7 +208,7 @@ export function XYDrag<OnNodeDrag extends (e: any, nodes: any, node: any) => voi
lastPos.x = (lastPos.x ?? 0) - xMovement / transform[2];
lastPos.y = (lastPos.y ?? 0) - yMovement / transform[2];
if (panBy({ x: xMovement, y: yMovement })) {
if (await panBy({ x: xMovement, y: yMovement })) {
updateNodes(lastPos as XYPosition, null);
}
}