From c55a99c876e64bd6686c1bfafbc0a983cebd3414 Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Thu, 13 Jul 2023 08:11:25 -0400 Subject: [PATCH] fix: Dragging node on left side when it has a loop [PT-185596219] --- src/components/graph.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/graph.tsx b/src/components/graph.tsx index 707dc25..bd96708 100644 --- a/src/components/graph.tsx +++ b/src/components/graph.tsx @@ -493,6 +493,8 @@ export const Graph = (props: Props) => { }) ; + const loopStyle = drawingMode === "delete" ? "cursor: pointer" : "pointer-events: none"; + const loopBackgrounds = svg .selectAll("path.loop-background") .data(d3Graph.nodes.filter(n => n.loops)) @@ -504,7 +506,7 @@ export const Graph = (props: Props) => { .attr("stroke-opacity", 0) .attr("fill-opacity", 0) .attr("stroke-width", 15) - .attr("style", drawingMode === "delete" ? "cursor: pointer" : "") + .attr("style", loopStyle) .on("click", (e, d) => { onNodeClick?.(d.id, true); }) @@ -522,7 +524,7 @@ export const Graph = (props: Props) => { .attr("fill-opacity", 0) .attr("stroke-width", d => d.loopWeight) .attr("marker-end", "url(#arrow)") - .attr("style", drawingMode === "delete" ? "cursor: pointer" : "") + .attr("style", loopStyle) .on("click", (e, d) => { onNodeClick?.(d.id, true); })