Skip to content

fix: pre-calculate cluster node positions and reduce drag disturbance#23

Open
Shanb007 wants to merge 2 commits intoBetterDB-inc:masterfrom
Shanb007:fix/cluster-topology-node-overlap
Open

fix: pre-calculate cluster node positions and reduce drag disturbance#23
Shanb007 wants to merge 2 commits intoBetterDB-inc:masterfrom
Shanb007:fix/cluster-topology-node-overlap

Conversation

@Shanb007
Copy link

@Shanb007 Shanb007 commented Feb 12, 2026

Summary

Fixes #3

Cluster topology graph nodes rendered tightly clustered on initial load and slowly animated apart. Additionally, clicking/dragging any single node caused all other nodes to reposition.

Changes

Pre-calculate initial node positions based on role

  • Master nodes are placed in a circle around the center of the canvas
  • Replica nodes are placed offset outward from their respective master
  • Saved positions (from previous drag) are still respected
  • This eliminates the tight clump -> slow spread animation on first render

Increase alphaDecay (0.0228 -> 0.05)

  • The simulation now settles ~2x faster since nodes already start in good positions
  • Only minor adjustments needed, no reason for a long animation

Lower drag alphaTarget (0.3 -> 0.01)

  • Previously, clicking any node reheated the entire force simulation to 0.3, causing all nodes to reposition
  • Now it only warms enough for links to follow the dragged node without disturbing neighbors

Note

Low Risk
UI-only layout/interaction changes confined to a single visualization component; main risk is unintended node placement or responsiveness issues on resize.

Overview
Improves the initial layout and interaction stability of the ClusterTopologyGraph by precomputing deterministic node positions (masters in a circle, replicas offset from their master) while still honoring any drag-saved positions.

Tweaks the D3 force simulation to settle faster and avoid disturbing the whole graph on drag: alphaDecay is increased and drag start uses a much lower alphaTarget; simulation “needs run” detection now keys off presence in nodePositionsRef rather than missing x/y (and layout now recalculates when containerWidth changes).

Written by Cursor Bugbot for commit e93acfc. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve cluster topology graph positioning and drag behavior

1 participant