feat(svelte): add nodesConnectable, nodesDraggable and elementsSelectable

This commit is contained in:
moklick
2023-05-22 12:24:35 +02:00
parent fb712a513f
commit ca4a6c20f9
10 changed files with 85 additions and 76 deletions
@@ -17,7 +17,9 @@
export let showFitView: $$Props['showFitView'] = true;
export let showInteractive: $$Props['showInteractive'] = true;
const { zoomIn, zoomOut, fitView, transform, minZoom, maxZoom } = useStore();
const {
zoomIn, zoomOut, fitView, transform, minZoom, maxZoom, nodesDraggable, nodesConnectable, elementsSelectable
} = useStore();
const isInteractive = true;
$: minZoomReached = $transform[2] <= $minZoom;
@@ -36,12 +38,9 @@
};
const onToggleInteractivity = () => {
// store.setState({
// nodesDraggable: !isInteractive,
// nodesConnectable: !isInteractive,
// elementsSelectable: !isInteractive,
// });
// onInteractiveChange?.(!isInteractive);
nodesDraggable.set(!isInteractive);
nodesConnectable.set(!isInteractive);
elementsSelectable.set(!isInteractive);
};
</script>