Skip to content

Add a per-bar option to draw the cooldown countdown above the keybind - #1860

Open
dfrisone wants to merge 1 commit into
EllesmereGaming:mainfrom
dfrisone:fix/ab-cooldown-text-layer
Open

Add a per-bar option to draw the cooldown countdown above the keybind#1860
dfrisone wants to merge 1 commit into
EllesmereGaming:mainfrom
dfrisone:fix/ab-cooldown-text-layer

Conversation

@dfrisone

Copy link
Copy Markdown
Contributor

Request: Discord report from @qpa (v9.0.8, Action Bars). On small action bars the text elements overlap and the keybind always wins, with no way to reverse it. Qpa noted this is current behavior rather than a bug, and asked for a layering option so the cooldown timer can be brought in front of the hotkey.

Issue: With only Keybind and Cooldown text enabled on a small bar, the two land in the same few pixels and the countdown is the one that gets hidden, which is usually the more useful of the pair.

Root cause: Blizzard's ActionButtonTemplate puts HotKey and Count inside a TextOverlayContainer declared at frameLevel 500, while $parentCooldown and chargeCooldown are declared useParentLevel="true" and so render at the button's own level. The countdown therefore can never draw above the keybind. The macro Name fontstring sits on the button's own layers, which is why it was already below the countdown.

Fix: Adds "Draw Above Keybind" to the per-bar Cooldown Text cog, off by default. When enabled, the bar's TextOverlayContainer drops to the button's frame level + 1 and the cooldown frames go to + 2.

Lowering the text rather than raising the cooldown is deliberate. The cooldown swipe is a region of the same frame as the countdown, so raising that frame would carry the swipe above the assisted combat highlight ring (+15), the assist tint (+14) and proc alerts, all of which are stacked above the swipe on purpose. Holding the cooldown at +2 leaves every one of those untouched. The keybind and charges text do end up under the swipe and dim while a cooldown runs, which is the tradeoff the option exists to make and is stated in its tooltip.

Turning the option back off re-slaves the cooldown with SetUsingParentLevel(true) and restores the container from a stored offset rather than an absolute level, since a bar relayout shifts every child's level along with the button. Bars that never enable the option return before touching any frame, so they keep useParentLevel intact and cost nothing. SetFrameLevel and SetUsingParentLevel are both protected and these frames inherit the action button's protection, so the pass is gated on InCombatLockdown and healed by the existing PLAYER_REGEN_ENABLED re-apply. The new key is carried by the Cooldown Text sync icon and its multi-apply.

Tested in game on live: the countdown draws in front of the keybind on a small bar, proc glow and assist highlight render unchanged on a button mid-cooldown, toggling the option back off restores the default order, a relayout after reverting still renders correctly, and flipping the option in combat applies cleanly on the combat drop. Pet and stance bars inherit SmallActionButtonTemplate, so they carry the same container and behave identically.

Blizzard's ActionButtonTemplate parks HotKey and Count in a
TextOverlayContainer at frameLevel 500 while the cooldown frames declare
useParentLevel, so the countdown always renders beneath them. On small
buttons the keybind and the countdown land in the same few pixels and the
keybind wins, hiding the more useful number.

Adds "Draw Above Keybind" to the per-bar Cooldown Text cog, off by default.
When on, the bar's text container drops to one level above the button and the
cooldown frames go one step above that. Lowering the text rather than raising
the cooldown keeps the swipe below the assist highlight ring, the assist tint
and proc alerts, which sit above it deliberately. The keybind and charges
text end up under the swipe, which is the point of the option.

Reverting re-slaves the cooldown with SetUsingParentLevel and restores the
container from a stored offset rather than an absolute level, since a bar
relayout shifts every child with the button. Bars that never enable the
option are skipped entirely.

SetFrameLevel and SetUsingParentLevel are both protected and these frames
inherit the action button's protection, so the pass is gated on combat and
healed by the existing PLAYER_REGEN_ENABLED re-apply.
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