ActionBars: fix Encounter Bar drifting sideways until Edit Mode reopens - #1180
Open
dfrisone wants to merge 1 commit into
Open
ActionBars: fix Encounter Bar drifting sideways until Edit Mode reopens#1180dfrisone wants to merge 1 commit into
dfrisone wants to merge 1 commit into
Conversation
A custom-positioned Encounter Bar is saved with whatever corner anchor StopMovingOrSizing produced (often BOTTOMLEFT). The frame is a layout frame that resizes to its widget content, and outside Edit Mode nothing re-centers a custom-positioned bar, so each content width change shifts the visible widgets around the pinned corner (about half the width delta, roughly 90px for the zone event crystal). Blizzard Edit Mode appears to fix it because RefreshEncounterBar pins minimumWidth 230 and re-lays-out, which is the reported "snaps back when I enter edit mode". Normalize saved Edit Mode layouts once at init: rewrite corner/side anchors on non-default-position EncounterBar systems to the equivalent horizontally-centered BOTTOM anchor, recomputed against the 230x30 envelope the bar had while being placed. Width changes then stay symmetric and the bar no longer walks. Runs once per session, defers on Edit Mode data readiness and combat, and saves through the same combined presets-plus-saved payload the Profiles import path already uses.
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.
Problem
Reported on Discord by @moreON (8.7.4, Unlock Mode section): the Encounter Bar "moves on its own" during play, then snaps back to its proper spot as soon as Blizzard Edit Mode is opened. Video triage showed the zone event crystal widget sitting about 90px left of the Edit Mode position, recurring after each fix.
Root cause (Blizzard layout data, not EUI code)
EUI is fully hands-off the EncounterBar (position is Blizzard-owned since 7.3.5). The drift comes from how Blizzard saves the anchor:
EncounterBaris aVerticalLayoutFramethat resizes to its widget content (UnitPowerBarAlt.xml).UpdateSystemAnchorInfostores whatever raw anchorStopMovingOrSizingproduced. Near a screen corner that is a corner point such asBOTTOMLEFT. Imported layout strings can carry the same shape.WidgetsLayoutonly re-centers the bar when it is in its default position. A custom-positioned bar just getsEncounterBar:Layout(), so every content width change re-extends the frame from the pinned corner, shifting the visible widgets by half the width delta (the event widget is ~230 wide, the bare crystal ~45, matching the observed ~90px).RefreshEncounterBarpinsEncounterBar.minimumWidth = 230and re-lays-out, so the bar always looks correct while Edit Mode is open.Fix
One-shot normalization at ActionBars init (
ns.NormalizeEncounterBarAnchors): walkC_EditMode.GetLayouts()and, for every non-preset layout where the EncounterBar system is custom-positioned with a single corner/side anchor to UIParent, rewrite it to the equivalent horizontally centeredBOTTOManchor. Offsets are recomputed against the 230x30 envelope Edit Mode pins while the bar is being placed, so the on-screen position is preserved exactly. Width changes then expand symmetrically and the bar stays put.Safety properties:
BOTTOMand never match again).EDIT_MODE_LAYOUTS_UPDATED) and on combat (PLAYER_REGEN_ENABLED), mirroring the CDM module's SaveLayouts-at-init-only rule.ApplyPresetEditModein EllesmereUI_Profiles.lua.Known limitation: re-dragging the bar in Edit Mode can reintroduce a corner anchor for the rest of that session; it is normalized again at next login.
Testing
nsinside a scoped block because the AB main chunk is at the 200-local cap.