From a4466c8d0a5974c0ee2dd843ad5f9fafffb6baa0 Mon Sep 17 00:00:00 2001 From: Dennis Collaris <d.collaris@me.com> Date: Tue, 20 Aug 2024 11:36:10 +0200 Subject: [PATCH] perf: prevent label update entirely when zoomed out --- .../lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx index 37b414265..7cdf747c3 100644 --- a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx +++ b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx @@ -561,7 +561,7 @@ export const NLPixi = (props: Props) => { }; const updateLinkLabel = (link: LinkTypeD3) => { - if (graph.current.nodes.length > config.LABEL_MAX_NODES) return; + if (graph.current.nodes.length > config.LABEL_MAX_NODES || viewport.current!.transform.scale.x < 2) return; const text = linkLabelMap.current.get(link._id); if (!text) return; @@ -606,7 +606,7 @@ export const NLPixi = (props: Props) => { }; const updateNodeLabel = (node: NodeTypeD3) => { - if (graph.current.nodes.length > config.LABEL_MAX_NODES) return; + if (graph.current.nodes.length > config.LABEL_MAX_NODES || viewport.current!.transform.scale.x < 2) return; const text = nodeLabelMap.current.get(node._id) as Text | undefined; if (text == null) return; -- GitLab