Skip to content

Stabilize ExtraIcons layout anchoring#101

Merged
argium merged 9 commits into
mainfrom
copilot/fix-icon-flickering-issue
May 18, 2026
Merged

Stabilize ExtraIcons layout anchoring#101
argium merged 9 commits into
mainfrom
copilot/fix-icon-flickering-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

ExtraIcons could repeatedly clear and reapply the same anchors while laying out its appended cooldown icons, which made the flicker-sensitive layout path harder to keep stable. The fix uses the shared FrameUtil guarded anchor helper, avoids anchoring extra icons to hidden active Blizzard item frames by falling back to the viewer frame, and includes regression coverage for the anchoring behavior.

Follow-up cleanup removes the overdone ELI5 comments, simplifies helper naming/structure, moves racial spell aliases into constants, and moves the shared safe frame diagnostic helper into ECM.lua.

Copilot AI changed the title [WIP] Fix item icons flickering during repositioning Stabilize ExtraIcons layout anchoring May 17, 2026
Copilot finished work on behalf of argium May 17, 2026 23:41
Copilot AI requested a review from argium May 17, 2026 23:41
Copilot finished work on behalf of argium May 18, 2026 02:58
Copilot finished work on behalf of argium May 18, 2026 03:44
@argium argium marked this pull request as ready for review May 18, 2026 04:40
Copilot AI review requested due to automatic review settings May 18, 2026 04:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Test Results

891 tests   - 5   891 ✅  - 5   2s ⏱️ ±0s
  5 suites ±0     0 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 1452260. ± Comparison against base commit 9591303.

This pull request removes 55 and adds 50 tests. Note that renamed tests count towards both.
Tests/Modules.ExtraIcons_spec_lua:1033 ‑ ExtraIcons real source uses GetItemFrames and isActive to detect icon size and anchor container
Tests/Modules.ExtraIcons_spec_lua:1063 ‑ ExtraIcons real source does not iterate inaccessible GetItemFrames results
Tests/Modules.ExtraIcons_spec_lua:1103 ‑ ExtraIcons real source logs viewer diagnostics when GetItemFrames fails
Tests/Modules.ExtraIcons_spec_lua:1139 ‑ ExtraIcons real source continues conservatively when GetItemFrames iteration fails
Tests/Modules.ExtraIcons_spec_lua:1192 ‑ ExtraIcons real source matches the utility viewer's square overlay footprint
Tests/Modules.ExtraIcons_spec_lua:1217 ‑ ExtraIcons real source skips disabled entries during layout resolution
Tests/Modules.ExtraIcons_spec_lua:1245 ‑ ExtraIcons real source publishes a combined main-viewer anchor when main extra icons are shown
Tests/Modules.ExtraIcons_spec_lua:1279 ‑ ExtraIcons real source restores the utility viewer when an icon moves to main
Tests/Modules.ExtraIcons_spec_lua:1482 ‑ ExtraIcons real source keeps a utility viewer anchored to main centered without same-parent coupling
Tests/Modules.ExtraIcons_spec_lua:1482 ‑ ExtraIcons real source keeps same-parent viewer rows centered for center anchors when utility becomes empty
…
Tests/Modules.ExtraIcons_spec_lua:1016 ‑ ExtraIcons real source does not iterate inaccessible GetItemFrames results
Tests/Modules.ExtraIcons_spec_lua:1056 ‑ ExtraIcons real source logs viewer diagnostics when GetItemFrames fails
Tests/Modules.ExtraIcons_spec_lua:1092 ‑ ExtraIcons real source continues conservatively when GetItemFrames iteration fails
Tests/Modules.ExtraIcons_spec_lua:1145 ‑ ExtraIcons real source matches the utility viewer's square overlay footprint
Tests/Modules.ExtraIcons_spec_lua:1170 ‑ ExtraIcons real source skips disabled entries during layout resolution
Tests/Modules.ExtraIcons_spec_lua:1198 ‑ ExtraIcons real source publishes a combined main-viewer anchor when main extra icons are shown
Tests/Modules.ExtraIcons_spec_lua:1232 ‑ ExtraIcons real source restores the utility viewer when an icon moves to main
Tests/Modules.ExtraIcons_spec_lua:1291 ‑ ExtraIcons real source prefers demonic healthstone over the legacy healthstone
Tests/Modules.ExtraIcons_spec_lua:1313 ‑ ExtraIcons real source resolves item stack entries through their priority list
Tests/Modules.ExtraIcons_spec_lua:1345 ‑ ExtraIcons real source prefers owned item stack entries over the missing fallback
…

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

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 pull request stabilizes ExtraIcons layout anchoring by switching repeated ClearAllPoints/SetPoint work to the shared FrameUtil.LazySetAnchors helper, reducing unnecessary re-anchoring (and potential flicker) during frequent layout passes. It also adds explanatory “ELI5” comments to make the layout flow easier to follow for future maintenance.

Changes:

  • Use FrameUtil.LazySetAnchors for Blizzard viewer, extra-icon container, and pooled icon anchoring to avoid reapplying unchanged anchors.
  • Avoid anchoring extra icons to hidden “active” Blizzard item frames; fall back to anchoring to the viewer frame instead.
  • Extend the real-source spec coverage with new tests for hidden-active-frame anchoring and for avoiding redundant anchor reapplication.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Modules/ExtraIcons.lua Replaces eager anchor resets with LazySetAnchors, tightens anchor selection to ignore hidden active frames, and adds clarifying comments around the layout algorithm.
Tests/Modules/ExtraIcons_spec.lua Loads real FrameUtil (with a stubbed ApplyFont) and adds regression tests covering the anchoring stability scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@argium
Copy link
Copy Markdown
Owner

argium commented May 18, 2026

Top of function comments must be changed to luadocm, not inlined below the signature.

@argium
Copy link
Copy Markdown
Owner

argium commented May 18, 2026

There are too many "resolve*" functions that are too similar. I feel like they can be refactored and compressed. It's not clear how they're all different just from their name alone.

@argium
Copy link
Copy Markdown
Owner

argium commented May 18, 2026

Remove the "ELI5:" comments. That was not in the intention of that instruction. It was to make the comments make sense, and not sound like an AI wrote it.

Comment thread Modules/ExtraIcons.lua Outdated
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't see why VIEWERS and BLIZZ_KEY are necessary. The keys aren't used. The comment (below) also makes no sense - They do not move together in edit mode - they are completely independent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed BLIZZ_KEY, removed the misleading VIEWERS comment, and kept only the viewer metadata that is still used for iteration/config lookup in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
local canAccessTable = _G.canaccesstable

-- Some racial abilities have different spell IDs for different races/factions.
-- This lookup lets a saved spell ID find its whole family of equivalent IDs.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Change:

Some racial abilities have different spell IDs. For example, Dracthyr evokers have a more potent wing buffet compared to other classes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the racial spell ID wording and moved the alias mapping into constants in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
-- ExtraIcons adds the user's chosen potions, trinkets, racials, and spells
-- directly after Blizzard's cooldown viewer rows. Think of each Blizzard row
-- as a train: this module adds a small extra car to the end without moving the
-- train station anchor that other ECM modules use.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed this top-level explanatory block in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
@@ -23,7 +29,9 @@ for _, racial in pairs(RACIAL_ABILITIES) do
end
end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can this be stored in the ideal format in constants instead of computed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the racial spell alias mapping into Constants.lua instead of computing it in ExtraIcons.lua in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
vs.originalPoint = { point, relativeTo, relativePoint, x or 0, y or 0 }
end

local function applyPoint(vs, blizzFrame, offsetX)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is this method required? LazySetAnchors is supposed to guard against no-op changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the helper and now call FrameUtil.LazySetAnchors directly at the offset application sites in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
Comment on lines +356 to +357
-- Count text is optional. Nil means "hide the number"; any value means
-- "show this number on top of the icon."
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

remove. obvious.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the obvious count-text comments in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated

local function updateIconCountText(icon, globalConfig, config)
-- Item icons can show stack counts and spell icons can show charges. Only
-- show useful numbers: one item or a non-charge spell should stay clean.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove this second sentence - pointless.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the extra sentence along with the ELI5 comment cleanup in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
--- Caches and returns the cooldown number font from a sibling Blizzard icon.
--- ELI5: copy Blizzard's number style so ECM's extra icons look like they
--- belong in the same row.
local function getSiblingFont(viewer)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This doesn't seem to work. Just remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed getCombatState; error logging already enriches diagnostics with combat state in 97fbdf9.

Comment thread Modules/ExtraIcons.lua Outdated
@@ -385,6 +443,8 @@ local function getItemFramesCount(itemFrames)
end

local function getCombatState()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this is a shared helper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the shared frame-method diagnostic helper into ECM.lua in 97fbdf9, with LuaDoc added in 4974c13.

Comment thread Modules/ExtraIcons.lua Outdated
@@ -421,6 +483,9 @@ local function getViewerDiagnostics(blizzFrame, viewerKey, why, itemFrames)
end

local function getAccessibleItemFrames(blizzFrame, viewerKey, why)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the unused utility anchor creation; anchors are now only created for viewer configs that own an anchor in 97fbdf9.

@argium
Copy link
Copy Markdown
Owner

argium commented May 18, 2026

@copilot address feedback

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 18, 2026

Top of function comments must be changed to luadocm, not inlined below the signature.

Removed the inline top-of-function comments and kept remaining function docs in LuaDoc style in 97fbdf9.

There are too many "resolve*" functions that are too similar. I feel like they can be refactored and compressed. It's not clear how they're all different just from their name alone.

Renamed and compressed the entry-resolution helpers so item, spell, equip-slot, and configured stack paths are clearer in 97fbdf9 and 1b418e7.

Remove the "ELI5:" comments. That was not in the intention of that instruction. It was to make the comments make sense, and not sound like an AI wrote it.

Removed the ELI5 comments in 97fbdf9.

@copilot address feedback

Addressed the feedback across 97fbdf9, 4974c13, and 1b418e7; full tests and luacheck pass.

Copilot finished work on behalf of argium May 18, 2026 08:54
Copilot AI requested a review from argium May 18, 2026 08:54
Copilot finished work on behalf of argium May 18, 2026 11:39
Copilot finished work on behalf of argium May 18, 2026 11:42
@argium argium merged commit aa91fbd into main May 18, 2026
4 checks passed
@argium argium deleted the copilot/fix-icon-flickering-issue branch May 18, 2026 11:44
argium pushed a commit that referenced this pull request May 19, 2026
ExtraIcons could repeatedly clear and reapply the same anchors while
laying out its appended cooldown icons, which made the flicker-sensitive
layout path harder to keep stable.
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.

Item icons can flicker when being repositioned, and/or are repositioned unnecessarily.

3 participants