Skip to content
Snippets Groups Projects
Commit 8b3a332c authored by Leonardo Christino's avatar Leonardo Christino Committed by Vink, S.A. (Sjoerd)
Browse files

fix(vis): remove read-only bug from nl

required refactor of how the graph data structure is handled by nl
parent 47ebac6a
No related branches found
No related tags found
1 merge request!151feat(map_nodelink)
This commit is part of merge request !151. Comments created here will be created in the context of that merge request.
...@@ -163,7 +163,7 @@ export const NLPixi = (props: Props) => { ...@@ -163,7 +163,7 @@ export const NLPixi = (props: Props) => {
onMouseUpStage(event: FederatedPointerEvent) { onMouseUpStage(event: FederatedPointerEvent) {
if (props.configuration.showPopUpOnHover) return; 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. // 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; const holdDownTime = event.timeStamp - (event as any).mouseDownTimeStamp;
if (holdDownTime < mouseClickThreshold) { if (holdDownTime < mouseClickThreshold) {
...@@ -198,7 +198,7 @@ export const NLPixi = (props: Props) => { ...@@ -198,7 +198,7 @@ export const NLPixi = (props: Props) => {
}, },
onMoved(event: MovedEvent) { onMoved(event: MovedEvent) {
if (props.configuration.showPopUpOnHover) return; if (props.configuration.showPopUpOnHover) return;
for (const popup of popups) { for (const popup of popups) {
if (popup.node.x == null || popup.node.y == null) continue; 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; popup.pos.x = event.viewport.transform.position.x + popup.node.x * event.viewport.scale.x;
...@@ -632,18 +632,22 @@ export const NLPixi = (props: Props) => { ...@@ -632,18 +632,22 @@ export const NLPixi = (props: Props) => {
<Tooltip key={popup.node._id} open={true} boundaryElement={ref} showArrow={true}> <Tooltip key={popup.node._id} open={true} boundaryElement={ref} showArrow={true}>
<TooltipTrigger x={popup.pos.x} y={popup.pos.y} /> <TooltipTrigger x={popup.pos.x} y={popup.pos.y} />
<TooltipContent> <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> </TooltipContent>
</Tooltip> </Tooltip>
))} ))}
{quickPopup != null && {quickPopup != null && (
<Tooltip key={quickPopup.node._id} open={true} boundaryElement={ref} showArrow={true}> <Tooltip key={quickPopup.node._id} open={true} boundaryElement={ref} showArrow={true}>
<TooltipTrigger x={quickPopup.pos.x} y={quickPopup.pos.y} /> <TooltipTrigger x={quickPopup.pos.x} y={quickPopup.pos.y} />
<TooltipContent> <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> </TooltipContent>
</Tooltip> </Tooltip>
} )}
<div <div
className="h-full w-full overflow-hidden" className="h-full w-full overflow-hidden"
ref={ref} ref={ref}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment