Merge pull request #5093 from xyflow/refactor/minimap-hidden
refactor(minimap): do not show hidden nodes
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/react': patch
|
||||||
|
'@xyflow/svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Hidden nodes are not displayed in the mini map anymore
|
||||||
@@ -15,6 +15,8 @@ import type { MiniMapProps } from './types';
|
|||||||
const defaultWidth = 200;
|
const defaultWidth = 200;
|
||||||
const defaultHeight = 150;
|
const defaultHeight = 150;
|
||||||
|
|
||||||
|
const filterHidden = (node: Node) => !node.hidden;
|
||||||
|
|
||||||
const selector = (s: ReactFlowState) => {
|
const selector = (s: ReactFlowState) => {
|
||||||
const viewBB: Rect = {
|
const viewBB: Rect = {
|
||||||
x: -s.transform[0] / s.transform[2],
|
x: -s.transform[0] / s.transform[2],
|
||||||
@@ -25,7 +27,10 @@ const selector = (s: ReactFlowState) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
viewBB,
|
viewBB,
|
||||||
boundingRect: s.nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds(s.nodeLookup), viewBB) : viewBB,
|
boundingRect:
|
||||||
|
s.nodeLookup.size > 0
|
||||||
|
? getBoundsOfRects(getInternalNodesBounds(s.nodeLookup, { filter: filterHidden }), viewBB)
|
||||||
|
: viewBB,
|
||||||
rfId: s.rfId,
|
rfId: s.rfId,
|
||||||
panZoom: s.panZoom,
|
panZoom: s.panZoom,
|
||||||
translateExtent: s.translateExtent,
|
translateExtent: s.translateExtent,
|
||||||
|
|||||||
@@ -76,7 +76,12 @@
|
|||||||
|
|
||||||
$: {
|
$: {
|
||||||
boundingRect =
|
boundingRect =
|
||||||
$nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds($nodeLookup), viewBB) : viewBB;
|
$nodeLookup.size > 0
|
||||||
|
? getBoundsOfRects(
|
||||||
|
getInternalNodesBounds($nodeLookup, { filter: (n) => !n.hidden }),
|
||||||
|
viewBB
|
||||||
|
)
|
||||||
|
: viewBB;
|
||||||
$nodes;
|
$nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user