Browse Source

Fix all event nodes to remain in place after dragging

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 <noreply@anthropic.com>
master
limina1 9 months ago
parent
commit
369005a631
  1. 14
      src/lib/navigator/EventNetwork/utils/forceSimulation.ts
  2. 13
      src/lib/navigator/EventNetwork/utils/starForceSimulation.ts

14
src/lib/navigator/EventNetwork/utils/forceSimulation.ts

@ -205,16 +205,10 @@ export function setupDragHandlers( @@ -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;
});
}

13
src/lib/navigator/EventNetwork/utils/starForceSimulation.ts

@ -247,15 +247,10 @@ export function createStarDragHandler( @@ -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()

Loading…
Cancel
Save