[D3/UI] Implement Zoom-to-Fit & Bound-Constrained Simulation #22

Closed
opened 2026-05-08 18:33:31 +00:00 by mjasin · 0 comments
Owner

Context: The graph simulation is unbounded, causing nodes to drift off-screen or cluster too tightly within the sidebar width.
Role: Frontend Engineer.
Task: Optimize the D3 viewport and force simulation constraints.
Requirements:

  1. Bounded Box: Implement a force constraint that keeps nodes within the IntelligenceContent width, preventing horizontal clipping.
  2. Zoom-to-Fit: On every graph update, trigger a smooth d3.zoom transition that automatically centers and scales the graph to fit all discovered nodes.
  3. Hierarchy Layout: Instead of a pure force-directed clump, implement a d3.forceY that gently pulls nodes into vertical "tiers" based on their appearance order in the text.
    Goal: Ensure the most relevant concept (active node) is always centered in the viewport.
**Context:** The graph simulation is unbounded, causing nodes to drift off-screen or cluster too tightly within the sidebar width. **Role:** Frontend Engineer. **Task:** Optimize the D3 viewport and force simulation constraints. **Requirements:** 1. **Bounded Box:** Implement a force constraint that keeps nodes within the `IntelligenceContent` width, preventing horizontal clipping. 2. **Zoom-to-Fit:** On every graph update, trigger a smooth `d3.zoom` transition that automatically centers and scales the graph to fit all discovered nodes. 3. **Hierarchy Layout:** Instead of a pure force-directed clump, implement a `d3.forceY` that gently pulls nodes into vertical "tiers" based on their appearance order in the text. **Goal:** Ensure the most relevant concept (active node) is always centered in the viewport.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mjasin/Nexus.Reader#22