refactor(react): use vanilla helpers for zoom and pan

This commit is contained in:
moklick
2023-05-22 15:54:19 +02:00
parent ca4a6c20f9
commit d8ef041737
13 changed files with 594 additions and 251 deletions
@@ -21,7 +21,7 @@
zoomIn, zoomOut, fitView, transform, minZoom, maxZoom, nodesDraggable, nodesConnectable, elementsSelectable
} = useStore();
const isInteractive = true;
$: isInteractive = $nodesDraggable || $nodesConnectable || $elementsSelectable;
$: minZoomReached = $transform[2] <= $minZoom;
$: maxZoomReached = $transform[2] >= $maxZoom;
@@ -38,9 +38,11 @@
};
const onToggleInteractivity = () => {
nodesDraggable.set(!isInteractive);
nodesConnectable.set(!isInteractive);
elementsSelectable.set(!isInteractive);
isInteractive = !isInteractive;
nodesDraggable.set(isInteractive);
nodesConnectable.set(isInteractive);
elementsSelectable.set(isInteractive);
};
</script>