File size: 638 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { derived } from 'svelte/store';
import { getNodesInside } from '@xyflow/system';
export function getVisibleNodes(store) {
    return derived([
        store.nodeLookup,
        store.onlyRenderVisibleElements,
        store.width,
        store.height,
        store.viewport,
        store.nodes
    ], ([nodeLookup, onlyRenderVisibleElements, width, height, viewport]) => {
        const transform = [viewport.x, viewport.y, viewport.zoom];
        return onlyRenderVisibleElements
            ? getNodesInside(nodeLookup, { x: 0, y: 0, width, height }, transform, true)
            : Array.from(nodeLookup.values());
    });
}