Skip to content

Adjusted EdgeLabelControls to actually move and render along the edge properly, and improved performance#15

Merged
carl-andersson-at-westermo merged 14 commits intomainfrom
fix/edgelabels
Feb 24, 2026
Merged

Adjusted EdgeLabelControls to actually move and render along the edge properly, and improved performance#15
carl-andersson-at-westermo merged 14 commits intomainfrom
fix/edgelabels

Conversation

@carl-andersson-at-westermo
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

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 refactors Avalonia edge-label layout so labels are positioned/rotated during EdgeControlBase layout (instead of each EdgeLabelControl self-updating), aiming to make labels track the rendered edge more accurately and reduce layout overhead.

Changes:

  • Added perpendicular-vector helpers in TypeExtensions to support offsetting labels relative to edge direction.
  • Simplified EdgeLabelControl (removed layout/size-change hooks; moved visibility handling to property change handler and default property values).
  • Moved label measurement/arrangement into EdgeControlBase.MeasureOverride/ArrangeOverride, including routed-edge midpoint calculation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 13 comments.

File Description
Westermo.GraphX.Controls.Avalonia/TypeExtensions.cs Adds perpendicular helpers used for label offset calculations.
Westermo.GraphX.Controls.Avalonia/Controls/Misc/IEdgeLabelControl.cs Updates the edge-label interface API surface (removes update/size methods; adds self-loop/flip flags).
Westermo.GraphX.Controls.Avalonia/Controls/EdgeLabels/EdgeLabelControl.cs Removes self-managed layout; relies on EdgeControlBase for positioning/rotation and updates default property values.
Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs Centralizes label measuring/arranging and adds midpoint logic for straight/routed/self-loop edges.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lControl.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

@carl-andersson-at-westermo carl-andersson-at-westermo merged commit 1750afe into main Feb 24, 2026
1 check passed
@carl-andersson-at-westermo carl-andersson-at-westermo deleted the fix/edgelabels branch February 24, 2026 12:50
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