Skip to content

Fix(Damage Meter): bars rendering at different sizes - #2051

Open
JuJuFX-dev wants to merge 2 commits into
EllesmereGaming:mainfrom
JuJuFX-dev:fix/dm-bar-height-ui-units
Open

Fix(Damage Meter): bars rendering at different sizes#2051
JuJuFX-dev wants to merge 2 commits into
EllesmereGaming:mainfrom
JuJuFX-dev:fix/dm-bar-height-ui-units

Conversation

@JuJuFX-dev

Copy link
Copy Markdown
Contributor

Bugreport: https://discord.com/channels/585577383847788554/1547524557643186178

What does this PR do?

Fixes Damage Meters bars rendering at different sizes for different users when a profile is shared. Bar Height (and the Spell History bar height and icon size) was converted to a physical pixel count (value * PP.mult), while everything else in the window (width, fonts, bar spacing) is in UI units. At any UI scale other than pixel-perfect, the bars therefore drifted out of proportion with their own window, so the same exported value looked thinner or thicker depending on the receiving user's resolution and UI scale (4K on the auto scale is affected too, since the scale clamps at 0.4).

These values are now treated as UI units and only snapped to the pixel grid, like the window width. RowMetrics keeps height and spacing on the same effective-scale grid, so the even spacing from the previous fix is preserved and no call site changes. Line thicknesses (borders, dividers, the thin-line texture) stay physical on purpose.

To avoid any visible change for existing users, a one-time global migration (dm_bar_height_ui_units_v1) multiplies the stored values by the old factor (768 / screen height / ppUIScale), so every profile that exists at update time keeps its exact rendered size. Pixel-perfect setups (factor within 1%) are left untouched. It is global rather than profile-scoped on purpose: profile stamps ride exports, so a profile-scope migration would convert old import strings with the recipient's factor and freeze their UI scale into the value. After the migration has run, imported values are read as UI units and render at the same relative size for everyone. A per-profile stamp keeps the body idempotent if a full-account import replaces the global migration flags.

Known limit: profiles that were imported before this update cannot be told apart from the user's own, so they keep their current look; re-importing the string after the update gives the exporter's intended size.

How was it tested?

Tested in-game on live at a non-pixel-perfect UI scale (factor 0.75): the migration ran without errors, converted the stored Bar Height from 30 to 22.5, and the bars rendered exactly as before the update.

Screenshots

N/A: existing profiles render unchanged by design.

Checklist

  • New settings default OFF (no behavior change without opt-in): N/A, no new settings; existing profiles keep their rendered size through the migration
  • Zero cost while disabled: no events registered, no polling, no hooks doing work, no frames built: no new events or hooks; the migration runs once at load
  • Cheap while enabled: event-driven (no polling, no timer-based logic, no per-frame allocations): only the size math changes, no new work per refresh
  • No writes onto Blizzard-owned frames (weak-table pattern used); HookScript/hooksecurefunc only, never SetScript on Blizzard frames: only addon-owned frames are touched
  • Tested in-game on live; no version gates or pre-Midnight APIs added

barHeight, shBarHeight and the spell history iconSize were converted to a
physical pixel count (value * PP.mult), while the window width, fonts and
bar spacing are coordinate units. At any UI scale other than pixel-perfect
the bars drifted out of proportion with their own window, so a shared
profile rendered visibly thinner or thicker bars depending on the receiving
user's resolution and UI scale.

Treat these values as coordinates and only snap them to the pixel grid.
RowMetrics keeps both terms on the frame's effective-scale grid, and its
fourth return value is still one physical pixel, so no call site changes.
Line thicknesses (borders, dividers, the thin line texture) stay physical.
Add a one-time global migration that multiplies barHeight and the Spell
History shBarHeight/iconSize by the old physical-pixel factor
(768 / screen height / ppUIScale), so every profile that exists at update
time keeps its exact rendered size. Pixel-perfect setups (factor within
1%) are left untouched.

Global scope keeps imports out of it: profile-scope stamps ride exports,
so an old string would be converted with the recipient's factor and
freeze their UI scale into it. After this ran, imported values are read
as UI units. A per-profile stamp keeps the body idempotent if a
full-account import replaces the global migration flags.
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