Skip to content

Fixed edge arrange when vertices are overlapping#27

Merged
carl-andersson-at-westermo merged 1 commit into
mainfrom
fix/arrange/edge
Jun 16, 2026
Merged

Fixed edge arrange when vertices are overlapping#27
carl-andersson-at-westermo merged 1 commit into
mainfrom
fix/arrange/edge

Conversation

@carl-andersson-at-westermo

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an Avalonia layout/arrange crash when edge endpoints coincide (overlapping vertices), improving stability of edge label positioning (and adding regression coverage) in the GraphX Avalonia controls library.

Changes:

  • Guard against zero direction vectors when normalizing the edge midpoint vector during label arrangement.
  • Skip arranging labels when computed label coordinates/sizes are non-finite to avoid invalid arrange rectangles.
  • Add a regression test covering overlapping vertices with an attached label (and an edge pointer template).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs Adds guards to prevent NaN/Infinity propagation into label (and related) arrange logic when vertices overlap.
Westermo.GraphX.Controls.Avalonia.Tests/EdgeControlAdvancedTests.cs Adds a regression test ensuring overlapping vertices + label does not throw during arrange.

Comment thread Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs
Comment thread Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs
Comment thread Westermo.GraphX.Controls.Avalonia.Tests/EdgeControlAdvancedTests.cs
@carl-andersson-at-westermo carl-andersson-at-westermo merged commit 55d7601 into main Jun 16, 2026
5 checks passed
@carl-andersson-at-westermo carl-andersson-at-westermo deleted the fix/arrange/edge branch June 16, 2026 13:03
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.

3 participants