Skip to content

Fix routing, replace ILayoutAlgorithm, and resolve Note divider issue#21

Merged
Malcolmnixon merged 1 commit into
mainfrom
fix/containment-routing-and-algorithm-api
Jul 14, 2026
Merged

Fix routing, replace ILayoutAlgorithm, and resolve Note divider issue#21
Malcolmnixon merged 1 commit into
mainfrom
fix/containment-routing-and-algorithm-api

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

This pull request introduces several key improvements to the rendering layout system, focusing on the connector routing algorithm and the extensibility of layout algorithms. The most significant changes include a fix to the connector routing obstacle handling, a new extensibility base class for layout algorithms, and updates to documentation and tests to reflect these changes.

Connector Routing Improvements

  • ConnectorRouter now treats endpoint boxes as obstacles: The routing algorithm now considers a connection’s own endpoint boxes as ordinary obstacles, except for the final docking stub, preventing connectors from being routed through their own target box’s interior. This closes a loophole where unrelated connectors could squeeze through endpoint boxes. [1] [2] [3] [4] [5] [6]
  • Added regression test and documentation: A new regression scenario and illustration demonstrate the fix for parallel edges converging on a compartment box, ensuring connectors do not cross the box’s interior. [1] [2] [3]

Layout Algorithm Extensibility

  • Introduced LayoutAlgorithmBase abstract class: Replaces the previous ILayoutAlgorithm interface with a more extensible base class, supporting single-surface configuration and composite algorithm recursion. This change simplifies the contract and enables internal extensibility without exposing additional public API. [1] [2]
  • Updated registry and references: The LayoutAlgorithmRegistry and related documentation are updated to use and reference LayoutAlgorithmBase instead of the old interface, ensuring consistency across the API. [1] [2] [3] [4] [5]

Miscellaneous Improvements

  • New utility method for Note fold size: Added NoteFoldSize to BoxMetrics for consistent geometry and content clearance around Note-shaped boxes.
  • Project and configuration updates: Added InternalsVisibleTo for layout assemblies and enabled embedded attribute polyfill for improved internal access and compatibility. [1] [2]
  • Spelling and word list update: Added “pathfinding” to the spelling dictionary.

…orithmBase, fix Note-fold divider overlap

- ConnectorRouter: stop excluding a connection's own endpoint boxes from the
  hard-obstacle set. Other connectors' soft obstacles could squeeze a route
  through its own target's interior (e.g. parallel edges converging on a
  compartment box). OrthogonalEdgeRouter's stub-then-dock approach already
  lets a connector leave/enter its own boxes cleanly, so removing the
  exclusion is a safe, minimal fix. Adds a regression test and a new gallery
  diagram (ParallelEdgesIntoCompartmentBox), and updates the connector-router
  design/requirements/verification docs to describe the corrected obstacle
  model.

- Replace the ILayoutAlgorithm interface with an abstract LayoutAlgorithmBase
  class exposing a sealed public Apply(LayoutGraph) and a protected internal
  ApplyCore(LayoutGraph, LayoutOptions) extension point. This closes an API
  footgun where an external caller could pass LayoutOptions that contradicted
  a graph's own CoreOptions.Algorithm setting; external consumers can now only
  reach the single-argument Apply(graph), while HierarchicalLayoutAlgorithm's
  internal recursion and same-assembly tests retain access to ApplyCore via
  InternalsVisibleTo. Pure rename/access-modifier change with no behavior
  change to any leaf algorithm.

- Fix a rendering defect where a Note-shaped box's compartment divider could
  be drawn above the bottom of the note's folded top-right corner, appearing
  as a stray line crossing the fold. The existing guard only protected the
  first compartment's divider; any later compartment (e.g. following an empty
  leading compartment) could still land in the fold region. Both SvgRenderer
  and SkiaRasterRenderer now clamp a Note's divider Y to the fold's bottom
  edge, using a new shared BoxMetrics.NoteFoldSize(box) helper that also
  deduplicates the fold-size math previously inlined separately in each
  renderer's outline-drawing code. Adds regression tests to both renderers'
  test suites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit 1873036 into main Jul 14, 2026
6 checks passed
@Malcolmnixon
Malcolmnixon deleted the fix/containment-routing-and-algorithm-api branch July 14, 2026 18:02
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.

1 participant