feat(svelte): add onlyRenderVisibleElements option

This commit is contained in:
moklick
2023-06-08 16:31:39 +02:00
parent 7e64969cd3
commit 0739528761
8 changed files with 33 additions and 5 deletions
@@ -5,8 +5,13 @@
import { NodeWrapper } from '$lib/components/NodeWrapper';
import { useStore } from '$lib/store';
const { nodes, nodesDraggable, nodesConnectable, elementsSelectable, updateNodeDimensions } =
useStore();
const {
visibleNodes,
nodesDraggable,
nodesConnectable,
elementsSelectable,
updateNodeDimensions
} = useStore();
const resizeObserver: ResizeObserver | null =
typeof ResizeObserver === 'undefined'
@@ -26,7 +31,7 @@
</script>
<div class="svelte-flow__nodes">
{#each $nodes as node (node.id)}
{#each $visibleNodes as node (node.id)}
{@const posOrigin = getPositionWithOrigin({
x: node.positionAbsolute?.x ?? 0,
y: node.positionAbsolute?.y ?? 0,