Skip to content

Migrate concept graph from Cytoscape to react-force-graph-3d - #7

Merged
emilio-balda merged 1 commit into
mainfrom
feat/3d-graph-viewer
Sep 3, 2026
Merged

emilio-balda merged 1 commit into
mainfrom
feat/3d-graph-viewer

Conversation

@emilio-balda

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the 2D Cytoscape concept graph in src/Graph.jsx with a 3D force-directed graph (react-force-graph-3d), which stays legible with real-sized bundles (~140+ nodes) instead of clumping into an unreadable blob.
  • Nodes use the library's default uniform sizing with SpriteText labels (tuned textHeight/offset for our longer multi-word titles), plus small fixed-size wireframe halos for stale/selected states.
  • Edge color/width both respond to search-match dimming and selection highlighting; clicking a node recenters the camera on it while preserving the current zoom level instead of forcing a zoom-in.
  • Swaps the cytoscape dependency for react-force-graph-3d, three, and three-spritetext.

Test plan

  • npm test (22 tests, 4 files) passes
  • npm run build succeeds
  • Manually verified in the dev server against the real ~140-concept bundle: node spacing/legibility, light/dark theme, search-filter dimming, stale/selected halos, zoom in/out/fit controls, and click-to-recenter-without-zoom behavior

Made with Cursor

Switches src/Graph.jsx from a 2D Cytoscape view to a 3D force-directed
graph so it scales to real-sized bundles: uniform node sizing, SpriteText
labels, and a camera that recenters on selection without changing zoom.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 09:23
@emilio-balda
emilio-balda merged commit b187133 into main Sep 3, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new zoom implementation scales the camera around the world origin instead of the current camera target, which can cause visible drift after panning/recentering.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR migrates the concept graph rendering in the viewer from Cytoscape (2D) to a Three.js-based 3D force-directed graph via react-force-graph-3d, aiming to keep larger real-world bundles readable while preserving search/selection-driven styling and view controls.

Changes:

  • Replaced Cytoscape graph rendering in src/Graph.jsx with react-force-graph-3d + custom Three.js node objects (SpriteText labels, stale/selected wireframe halos).
  • Implemented theme-aware background, node/edge dimming on search matches, and selection-based edge highlighting plus click-to-recenter camera logic.
  • Swapped dependencies: removed cytoscape, added react-force-graph-3d, three, and three-spritetext.
File summaries
File Description
src/Graph.jsx Migrates graph visualization to 3D force graph and re-implements styling/interaction (dimming, selection, zoom/fit, recenter).
package.json Removes Cytoscape and adds the 3D force graph + Three.js dependencies.
package-lock.json Updates lockfile to reflect the new dependency tree.
Review details
  • Files reviewed: 2/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Graph.jsx
Comment on lines +209 to 212
const { x, y, z } = graph.camera().position;
const scale = 1 / factor;
graph.cameraPosition({ x: x * scale, y: y * scale, z: z * scale }, undefined, 200);
}
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.

2 participants