Skip to content

fix: clear render and text caches on theme change in PassPolarPlotControl#64

Open
magicbug with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-code-for-review-comment
Open

fix: clear render and text caches on theme change in PassPolarPlotControl#64
magicbug with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-code-for-review-comment

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown

PassPolarPlotControl cached FormattedText and render resources (SolidColorBrush, Pen) but never invalidated those caches on theme change, causing N/E/S/W cardinal labels and plot geometry to render with stale palette colours after switching themes.

Changes

  • PassPolarPlotControl — overrides OnAttachedToVisualTree/OnDetachedFromVisualTree to subscribe/unsubscribe from ActualThemeVariantChanged, clearing _renderCache and _textCache on each theme switch. Mirrors the existing pattern in SkyPlotControl and WorldMapControl.

  • FormattedTextCache — the Get(name, fontSize, Color foreground) overload used only (name, fontSize) as the cache key, so a colour change for the same text+size silently returned a stale entry. Key expanded to (name, fontSize, foreground):

// Before — foreground colour not part of key
var key = (name, fontSize);

// After — colour change produces a distinct cache entry
var key = (name, fontSize, foreground);

Copilot AI changed the title [WIP] Fix code as per review comment fix: clear render and text caches on theme change in PassPolarPlotControl Jul 10, 2026
Copilot AI requested a review from magicbug July 10, 2026 21:20
@magicbug magicbug marked this pull request as ready for review July 10, 2026 21:29
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