Skip to content

Add line jump rendering for edge crossings - #1029

Draft
snuziale wants to merge 1 commit into
mainfrom
claude/xyflow-line-jump-arcs-rv7myk
Draft

Add line jump rendering for edge crossings#1029
snuziale wants to merge 1 commit into
mainfrom
claude/xyflow-line-jump-arcs-rv7myk

Conversation

@snuziale

@snuziale snuziale commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements visual line jumps (notches) where edges cross each other in waypoint-routed paths. When two edges intersect, the horizontal segment now draws a small arc to hop over the vertical one, making criss-crossing lines more readable. This is an opt-in feature controlled by the enableLineJumps flag on CanvasEdgeData.

Key Changes

  • New crossing detection system (packages/apollo-react/src/canvas/components/Edges/shared/crossings/):

    • crossings.ts: Core algorithm that finds all horizontal-vertical segment intersections and computes jump points
    • EdgeCrossingsContext.tsx: Shared store for registering edge polylines and deriving crossings with granular per-edge subscriptions
    • useEdgeLineJumps.ts: Hook for edges to publish their geometry and consume jump data
    • Comprehensive test coverage for both the algorithm and integration
  • Path rendering updates (geometry.ts):

    • createRoundedPath() now accepts optional jumps parameter
    • New appendRun() function draws straight segments with semicircular arcs at crossing points
    • Arcs are positioned to avoid eating into rounded corners or stacking too densely
    • Sweep flag flips based on travel direction so all arcs bulge consistently
  • Integration:

    • EdgeCrossingsProvider mounted in CanvasProviders to enable the feature tree-wide
    • useEdgeGeometry hook updated to call useEdgeLineJumps and pass jumps to path builder
    • New enableLineJumps field on CanvasEdgeData type
    • LINE_JUMP_RADIUS constant added to EDGE_CONSTANTS
  • Storybook story demonstrating the feature with three horizontal edges crossing two vertical ones, with a toggle to compare against flat crossings

Implementation Details

  • Orientation-based stability: Only horizontal segments get jumps (vertical lines draw straight through), keeping the notch pattern stable during node drags
  • Strict interior intersections: Crossings at segment endpoints (T-junctions, shared nodes) are ignored
  • Deduplication: Verticals stacked on the same x-coordinate collapse into a single jump
  • Microtask coalescing: Store recomputes once per commit, draining before paint so notches appear immediately
  • Snapshot identity: Jump lists maintain stable identity until their own positions change, enabling efficient memoization
  • Waypoint routing only: Feature requires explicit vertex data; handle-routed edges produce no jumps

https://claude.ai/code/session_01C3Toj3SHbt75zwJ9ufqojS

Waypoint-routed edges can now hop over the edges they cross, so
criss-crossing lines read as passing over rather than joining. Opt in per
edge with `data.enableLineJumps`.

Edges publish their polylines to a shared `EdgeCrossingsStore`, which
derives every crossing once per commit and hands each edge back only its
own jumps. At a crossing it is the horizontal segment that arcs, which
keeps the notch pattern stable while nodes are dragged. Jumps are derived
from the vertices and only ever change the path string, so publishing
cannot re-trigger the computation that produced it.

`createRoundedPath` grows an optional `jumps` argument that replaces a
stretch of a straight run with a semicircular arc. Jumps that would eat
into a rounded corner, or that sit closer together than one arc width,
are dropped so a densely crossed stretch degrades to fewer notches
instead of a scalloped line.

Waypoint routing only: handle-routed edges produce a path string with no
vertices to intersect.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C3Toj3SHbt75zwJ9ufqojS
Copilot AI lite review requested due to automatic review settings August 8, 2026 21:50
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Aug 08, 2026, 02:55:18 PM
apollo-docs Ready Preview · Logs Aug 08, 2026, 02:55:18 PM
apollo-landing Ready Preview · Logs Aug 08, 2026, 02:55:18 PM
apollo-vertex Ready Preview · Logs Aug 08, 2026, 02:55:18 PM

@github-actions github-actions Bot added the size:XL 500-999 changed lines. label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1950 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1720
ISC 89
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.2 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

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.

Pull request overview

Adds an opt-in “line jump” rendering feature for waypoint-routed canvas edges, improving readability at edge crossings by drawing a small arc on the horizontal segment where it intersects another edge.

Changes:

  • Introduces a crossings registry + intersection algorithm to compute per-edge jump points.
  • Extends waypoint edge path building (createRoundedPath) to render semicircular jump arcs at crossing points.
  • Wires the feature into canvas rendering via CanvasProviders, CanvasEdge, and useEdgeGeometry, plus adds Storybook + unit/integration tests.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/apollo-react/src/canvas/components/Edges/shared/types.ts Adds PathJump type and enableLineJumps flag to CanvasEdgeData.
packages/apollo-react/src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts Publishes edge geometry to crossings store and passes computed jumps into path builder.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.ts Enhances createRoundedPath to optionally render jump arcs along straight runs.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.test.ts Adds unit tests for jump arc rendering behavior and edge cases.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/useEdgeLineJumps.ts New hook to register polylines and subscribe to computed jump snapshots.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/useEdgeLineJumps.test.tsx Integration tests validating provider behavior and opt-in semantics.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/index.ts Barrel exports for crossings feature modules.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/EdgeCrossingsContext.tsx Adds EdgeCrossingsStore + provider for shared recomputation and per-edge subscriptions.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/crossings.ts Implements horizontal–vertical crossing detection and stable jump list equality.
packages/apollo-react/src/canvas/components/Edges/shared/crossings/crossings.test.ts Unit tests for crossing detection and equality logic.
packages/apollo-react/src/canvas/components/Edges/shared/constants.ts Adds LINE_JUMP_RADIUS constant used by arc rendering and spacing/clearance rules.
packages/apollo-react/src/canvas/components/Edges/index.ts Exposes new crossings utilities/types from the Edges entrypoint.
packages/apollo-react/src/canvas/components/Edges/CanvasEdge.tsx Plumbs enableLineJumps from edge data into geometry computation.
packages/apollo-react/src/canvas/components/Edges/CanvasEdge.stories.tsx Adds a Storybook scenario demonstrating line jumps with a toggle.
packages/apollo-react/src/canvas/components/BaseCanvas/CanvasProviders.tsx Mounts EdgeCrossingsProvider in the canvas provider tree.
Suppressed comments (1)

packages/apollo-react/src/canvas/components/Edges/shared/crossings/crossings.ts:46

  • computeLineJumps only reads from polylines, so accepting a readonly array makes the API easier to use (e.g. with as const fixtures) and better communicates that inputs are not mutated.
export function computeLineJumps(polylines: EdgePolyline[]): Map<string, PathJump[]> {

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

Comment on lines +7 to +11
export type EdgePolyline = {
edgeId: string;
/** Ordered path vertices. Segment `i` runs from `points[i]` to `points[i + 1]`. */
points: Point[];
};
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core 43.84 MB 57.45 MB ±0
@uipath/apollo-react 39.5% 88.5% (154/174) 7.52 MB 28.90 MB +8.2 KB
@uipath/apollo-wind 420.6 KB 2.73 MB +24 B
@uipath/ap-chat 85.8% 43.46 MB 56.06 MB ±0

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 8 changed, 1 added (of 303 compared, 294 unchanged). View report

Baseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs

Updated (PT): Aug 08, 2026, 03:09:48 PM

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

Labels

pkg:apollo-react size:XL 500-999 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants