From 369005a631fef90c95700547e54cd6325cf78b0a Mon Sep 17 00:00:00 2001 From: limina1 Date: Mon, 23 Jun 2025 13:32:00 -0400 Subject: [PATCH] Fix all event nodes to remain in place after dragging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, only certain node types (person anchors, tag anchors, and 30040 events) would remain fixed after dragging, while other event types like kind 1 would snap back to their force-simulated positions. Now all event nodes remain fixed in their dragged position, giving users full control over the graph layout. This applies to both regular force simulation and star visualization modes. Changes: - Modified setupDragHandlers to keep all nodes fixed after drag ends - Modified createStarDragHandler to keep all nodes fixed after drag ends - Removed special cases that only fixed certain node types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../EventNetwork/utils/forceSimulation.ts | 14 ++++---------- .../EventNetwork/utils/starForceSimulation.ts | 13 ++++--------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/lib/navigator/EventNetwork/utils/forceSimulation.ts b/src/lib/navigator/EventNetwork/utils/forceSimulation.ts index bb21ebb..17d65bc 100644 --- a/src/lib/navigator/EventNetwork/utils/forceSimulation.ts +++ b/src/lib/navigator/EventNetwork/utils/forceSimulation.ts @@ -205,16 +205,10 @@ export function setupDragHandlers( simulation.alphaTarget(0); } - // Person anchors should remain fixed after dragging - if (d.isPersonAnchor) { - // Keep the new position fixed - d.fx = d.x; - d.fy = d.y; - } else { - // Release fixed position for other nodes - d.fx = null; - d.fy = null; - } + // Keep all nodes fixed after dragging + // This allows users to manually position any node type + d.fx = d.x; + d.fy = d.y; }); } diff --git a/src/lib/navigator/EventNetwork/utils/starForceSimulation.ts b/src/lib/navigator/EventNetwork/utils/starForceSimulation.ts index 7c52e8d..3c6cff8 100644 --- a/src/lib/navigator/EventNetwork/utils/starForceSimulation.ts +++ b/src/lib/navigator/EventNetwork/utils/starForceSimulation.ts @@ -247,15 +247,10 @@ export function createStarDragHandler( function dragended(event: any, d: NetworkNode) { if (!event.active) simulation.alphaTarget(0); - // Tag anchors, person anchors, and star centers stay fixed after dragging - if (d.isTagAnchor || d.isPersonAnchor || d.kind === 30040) { - d.fx = event.x; - d.fy = event.y; - } else { - // Let content nodes float - d.fx = null; - d.fy = null; - } + // Keep all nodes fixed after dragging + // This allows users to manually position any node type + d.fx = event.x; + d.fy = event.y; } return d3.drag()