Fix BUG Unitframes: detached power bar layering + power bar border#373
Open
Aderfi wants to merge 1 commit into
Open
Fix BUG Unitframes: detached power bar layering + power bar border#373Aderfi wants to merge 1 commit into
Aderfi wants to merge 1 commit into
Conversation
…lth border When the power bar is detached and positioned over the health bar edge, the unit frame's unified border (frame level +10) rendered on top of the power bar because ReparentBarsToClip forced the detached bar down to health level +2. The bar now stays at frame level +12 so the health border no longer shows through it. Also fixes the power bar border never appearing when switching a bar to detached at runtime: the border frame was only created at spawn time for already-detached bars. Border creation is now centralized in a single ApplyPowerBarBorder helper that lazily creates the frame and re-derives its level from the bar, called from CreatePowerBar, ReparentBarsToClip and the reload paths (removing the duplicated inline blocks).
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.
The bug
Two related issues with the detached power bar on unit frames (player / target / focus / etc.):
Cause
CreatePowerBarintentionally placed a detached power bar at frame level +12 (above the border), butReparentBarsToCliplater clobbered that, forcing every power bar down to health level +2 (= frame level +4). That left the detached bar and its border below the health border, so the border showed through._pbBorder) was only created at spawn time, and only when the bar was already detached. Switching a bar to detached at runtime goes through the in-place reload path, which only updated an existing border (if frame.Power._pbBorder then ...) and never created one — so the border options did nothing.The fix
ReparentBarsToClipnow keeps a detached power bar at frame level +12 (above the unified border), while attached bars keep the health level +2 behaviour needed to sit above the absorb overlay.ApplyPowerBarBorderhelper that lazily creates the border frame (so a live attached → detached switch picks it up) and always re-derives the border's frame level from the bar's current level. It's called fromCreatePowerBar, fromReparentBarsToClip(after the level is re-asserted, so textured borders track the bar too), and from the reload paths.Testing
Tested in-game: the health border no longer shows through the detached power bar, and selecting a border style/size for the power bar now applies correctly, including when switching a bar to detached without a
/reload.