Add a per-bar option to draw the cooldown countdown above the keybind - #1860
Open
dfrisone wants to merge 1 commit into
Open
Add a per-bar option to draw the cooldown countdown above the keybind#1860dfrisone wants to merge 1 commit into
dfrisone wants to merge 1 commit into
Conversation
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.
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.
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.