From 8b3a332cec85c793553a7e67a00dce568b61806d Mon Sep 17 00:00:00 2001 From: Milho001 <l.milhomemfrancochristino@uu.nl> Date: Thu, 4 Jul 2024 12:39:17 +0000 Subject: [PATCH] fix(vis): remove read-only bug from nl required refactor of how the graph data structure is handled by nl --- .../nodelinkvis/components/NLPixi.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx index 9d59adebd..e6f199d34 100644 --- a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx +++ b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx @@ -163,7 +163,7 @@ export const NLPixi = (props: Props) => { onMouseUpStage(event: FederatedPointerEvent) { if (props.configuration.showPopUpOnHover) return; - + // If its a short click (not a drag) on the stage but not on a node: clear the selection and remove all popups. const holdDownTime = event.timeStamp - (event as any).mouseDownTimeStamp; if (holdDownTime < mouseClickThreshold) { @@ -198,7 +198,7 @@ export const NLPixi = (props: Props) => { }, onMoved(event: MovedEvent) { if (props.configuration.showPopUpOnHover) return; - + for (const popup of popups) { if (popup.node.x == null || popup.node.y == null) continue; popup.pos.x = event.viewport.transform.position.x + popup.node.x * event.viewport.scale.x; @@ -632,18 +632,22 @@ export const NLPixi = (props: Props) => { <Tooltip key={popup.node._id} open={true} boundaryElement={ref} showArrow={true}> <TooltipTrigger x={popup.pos.x} y={popup.pos.y} /> <TooltipContent> - <NLPopup onClose={() => {}} data={{node: props.graph.nodes[popup.node._id], pos: popup.pos}} key={popup.node._id} /> + <NLPopup onClose={() => {}} data={{ node: props.graph.nodes[popup.node._id], pos: popup.pos }} key={popup.node._id} /> </TooltipContent> </Tooltip> ))} - {quickPopup != null && + {quickPopup != null && ( <Tooltip key={quickPopup.node._id} open={true} boundaryElement={ref} showArrow={true}> <TooltipTrigger x={quickPopup.pos.x} y={quickPopup.pos.y} /> <TooltipContent> - <NLPopup onClose={() => {}} data={{node: props.graph.nodes[quickPopup.node._id], pos: quickPopup.pos}} key={quickPopup.node._id} /> + <NLPopup + onClose={() => {}} + data={{ node: props.graph.nodes[quickPopup.node._id], pos: quickPopup.pos }} + key={quickPopup.node._id} + /> </TooltipContent> </Tooltip> - } + )} <div className="h-full w-full overflow-hidden" ref={ref} -- GitLab