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. 10
      src/lib/navigator/EventNetwork/utils/forceSimulation.ts
  2. 9
      src/lib/navigator/EventNetwork/utils/starForceSimulation.ts

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

@ -205,16 +205,10 @@ export function setupDragHandlers(
simulation.alphaTarget(0); simulation.alphaTarget(0);
} }
// Person anchors should remain fixed after dragging // Keep all nodes fixed after dragging
if (d.isPersonAnchor) { // This allows users to manually position any node type
// Keep the new position fixed
d.fx = d.x; d.fx = d.x;
d.fy = d.y; d.fy = d.y;
} else {
// Release fixed position for other nodes
d.fx = null;
d.fy = null;
}
}); });
} }

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

@ -247,15 +247,10 @@ export function createStarDragHandler(
function dragended(event: any, d: NetworkNode) { function dragended(event: any, d: NetworkNode) {
if (!event.active) simulation.alphaTarget(0); if (!event.active) simulation.alphaTarget(0);
// Tag anchors, person anchors, and star centers stay fixed after dragging // Keep all nodes fixed after dragging
if (d.isTagAnchor || d.isPersonAnchor || d.kind === 30040) { // This allows users to manually position any node type
d.fx = event.x; d.fx = event.x;
d.fy = event.y; d.fy = event.y;
} else {
// Let content nodes float
d.fx = null;
d.fy = null;
}
} }
return d3.drag() return d3.drag()

Loading…
Cancel
Save