Fix badge icons showing only bottom-right quadrant - #24
Merged
Conversation
In Avalonia, placing a Margin on a Grid used as an ItemsPanel does not offset the items the same way as in WPF, causing badges to render at the wrong position (only the bottom-right corner visible). Fix: apply BadgeMargin directly to the ItemsControl (Top/Left alignment) so the ItemsControl's top-left corner lands at the dot centre, and remove the margin from the Grid panel so items render from (0,0) within it. Update BadgeMargin formula from (size/2 - badgeSize/2) to (size/2, size/2) to match: the ItemsControl top-left is now placed at the dot centre rather than centred relative to it. Also set ClipToBounds=False on MinifiedLocation Grid so badge overflow beyond the location dot bounds is visible (badge extends to lower-right). Fixes #9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The PR moved BadgeMargin from the Grid panel to the ItemsControl (correct for Avalonia), but updated the formula to size/2 which placed the badge's top-left at the dot centre, offsetting it to the bottom-right. Restore the original centering formula: offset = (size - badgeSize) / 2 so the badge is symmetrically centred over the location dot, matching WPF v2 behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Badge icons (e.g. captured entrance indicators) were rendering incorrectly in Avalonia — only the bottom-right quadrant was visible rather than the badge being centred on the location dot.
Root cause: In Avalonia, applying
Marginto aGridused as anItemsPaneldoes not offset items the same way as in WPF, causing the badge to render at the wrong position.Changes:
BadgeMarginfrom theGridpanel to theItemsControlitself, withHorizontalAlignment="Left"/VerticalAlignment="Top", so Avalonia applies the margin correctly at the container levelBadgeMarginformula to(size - badgeSize) / 2on each axis, centring the badge over the location dot (matching WPF v2 behaviour)ClipToBounds="False"on theMinifiedLocationGrid so badge overflow beyond the location dot bounds is visibleNote: An intermediate version of this PR used
size / 2as the formula, which incorrectly placed the badge's top-left corner at the dot centre (bottom-right offset). The correct formula is(size - badgeSize) / 2, which centres the badge symmetrically over the dot.Test plan
Closes #9
🤖 Generated with Claude Code