Adjusted EdgeLabelControls to actually move and render along the edge properly, and improved performance#15
Merged
carl-andersson-at-westermo merged 14 commits intomainfrom Feb 24, 2026
Merged
Conversation
… properly, and improved performance
Copilot started reviewing on behalf of
carl-andersson-at-westermo
February 24, 2026 09:24
View session
Contributor
There was a problem hiding this comment.
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
TypeExtensionsto 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. |
Westermo.GraphX.Controls.Avalonia/Controls/EdgeLabels/EdgeLabelControl.cs
Outdated
Show resolved
Hide resolved
Westermo.GraphX.Controls.Avalonia/Controls/EdgeLabels/EdgeLabelControl.cs
Outdated
Show resolved
Hide resolved
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>
Copilot started reviewing on behalf of
carl-andersson-at-westermo
February 24, 2026 12:25
View session
Westermo.GraphX.Controls.Avalonia/Controls/EdgePointers/DefaultEdgePointer.cs
Outdated
Show resolved
Hide resolved
Westermo.GraphX.Controls.Avalonia/Controls/EdgePointers/DefaultEdgePointer.cs
Outdated
Show resolved
Hide resolved
…tEdgePointer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
AndersPantzarWestermo
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.