Skip to content

Fix badge icons showing only bottom-right quadrant - #24

Merged
emosaru merged 2 commits into
avaloniafrom
fix/issue-9-badge-icons-quadrant
Apr 11, 2026
Merged

Fix badge icons showing only bottom-right quadrant#24
emosaru merged 2 commits into
avaloniafrom
fix/issue-9-badge-icons-quadrant

Conversation

@emosaru

@emosaru emosaru commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

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 Margin to a Grid used as an ItemsPanel does not offset items the same way as in WPF, causing the badge to render at the wrong position.

Changes:

  • Move BadgeMargin from the Grid panel to the ItemsControl itself, with HorizontalAlignment="Left" / VerticalAlignment="Top", so Avalonia applies the margin correctly at the container level
  • Update BadgeMargin formula to (size - badgeSize) / 2 on each axis, centring the badge over the location dot (matching WPF v2 behaviour)
  • Set ClipToBounds="False" on the MinifiedLocation Grid so badge overflow beyond the location dot bounds is visible

Note: An intermediate version of this PR used size / 2 as 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

  • Open CodeTracker with Entrance Mode enabled
  • Capture an entrance — verify the badge icon is centred on the location dot
  • Verify the badge does not appear clipped or offset to one side

Closes #9

🤖 Generated with Claude Code

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>
@emosaru
emosaru requested a review from a team April 11, 2026 19:13
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>
@emosaru
emosaru merged commit 1d3536e into avalonia Apr 11, 2026
3 checks passed
@emosaru
emosaru deleted the fix/issue-9-badge-icons-quadrant branch April 11, 2026 21:09
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