From 87da717402dfc3b9af046831abeb065b0f0d4b4f Mon Sep 17 00:00:00 2001 From: Glyalith Date: Wed, 16 Sep 2026 14:16:48 -0600 Subject: [PATCH] Fix character sheet socket strip overflow --- .../EllesmereUIBlizzardSkin_SocketPanel.lua | 82 +++++++++++++++++-- EllesmereUILocales/_keys.txt | 4 +- 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/EllesmereUIBlizzardSkin/EllesmereUIBlizzardSkin_SocketPanel.lua b/EllesmereUIBlizzardSkin/EllesmereUIBlizzardSkin_SocketPanel.lua index e0005d49e..74fec10d2 100644 --- a/EllesmereUIBlizzardSkin/EllesmereUIBlizzardSkin_SocketPanel.lua +++ b/EllesmereUIBlizzardSkin/EllesmereUIBlizzardSkin_SocketPanel.lua @@ -2,7 +2,7 @@ if EUI_CLIENT_BLOCKED then return end -- pre-12.1 client failsafe (EllesmereUI_C -------------------------------------------------------------------------------- -- Character Sheet Socket Panel -- --- A single bare row of socket icons in the blank strip along the bottom +-- A bounded row of socket icons in the blank strip along the bottom -- edge of the EUI-skinned character sheet, right-aligned. Each icon is one -- socket on a currently-equipped item: -- filled sockets paint the gem, empty sockets paint the empty-socket texture. @@ -38,6 +38,8 @@ local CHasItem = _G.CursorHasItem -- Constants local SIZE = 28 local PAD = 4 +local MAX_SOCKET_ICONS = 6 +local PAGE_BUTTON_W = 12 local ROW_H = 20 -- gem flyout row height local FLYOUT_W = 240 local MAX_FLYOUT_ROWS = 12 -- flyout caps here; extra gems scroll with the wheel @@ -64,6 +66,8 @@ local gemDirty = true local pendingGemLoads = {} -- itemID -> true: bag gems whose data load we requested local socketLoadRequested = {} -- gem itemID -> true: equipped-gem data loads we requested local activeIcon = nil -- icon whose flyout is currently open +local socketPage = 0 +local prevPage, nextPage local flyoutScroll = 0 -- top gem index offset when the gem list overflows MAX_FLYOUT_ROWS local flyoutHoverMode = false -- flyout opened by hovering an empty socket (auto-closes on leave) local ourSession = false -- a socketing session WE opened is (or may still be) live @@ -226,6 +230,7 @@ local function SafeCloseSession() end local RebuildSockets -- forward declaration +local LayoutSockets local CloseFlyout -- forward declaration local OpenFlyout -- forward declaration local MaybeCloseHoverFlyout -- forward declaration @@ -598,15 +603,78 @@ RebuildSockets = function() end end + LayoutSockets() +end + +local function ChangeSocketPage(delta) + local last = math.max(0, math.ceil(#sockets / (MAX_SOCKET_ICONS - 1)) - 1) + local page = math.max(0, math.min(last, socketPage + delta)) + if page == socketPage then return end + CloseFlyout() + StopSlotGlow() + GameTooltip:Hide() + if EllesmereUI.HideWidgetTooltip then EllesmereUI.HideWidgetTooltip() end + socketPage = page + LayoutSockets() +end + +local function BuildPageButton(text, delta, tip) + local btn = CreateFrame("Button", nil, panel) + btn:SetSize(PAGE_BUTTON_W, SIZE) + local label = btn:CreateFontString(nil, "OVERLAY", "GameFontNormal") + label:SetAllPoints(btn) + label:SetText(text) + btn:SetScript("OnClick", function() ChangeSocketPage(delta) end) + btn:SetScript("OnEnter", function(self) + EllesmereUI.ShowWidgetTooltip(self, tip) + end) + btn:SetScript("OnLeave", function() EllesmereUI.HideWidgetTooltip() end) + return btn +end + +LayoutSockets = function() if not panel then return end + local count = #sockets + local paged = count > MAX_SOCKET_ICONS + -- Reserve one icon's width for the arrows, keeping the entire strip no + -- wider than the original six-socket layout, including on the last page. + local perPage = paged and (MAX_SOCKET_ICONS - 1) or MAX_SOCKET_ICONS + local last = math.max(0, math.ceil(count / perPage) - 1) + socketPage = math.min(socketPage, last) + local first = socketPage * perPage + local visible = math.min(perPage, count - first) + if activeIcon then + local old = activeIcon.euiSock + local keep = false + for i = 1, visible do + local rec = sockets[first + i] + if activeIcon == iconPool[i] and old and old.slot == rec.slot + and old.socketIndex == rec.socketIndex then keep = true; break end + end + if not keep then CloseFlyout(); StopSlotGlow() end + end + if paged and not prevPage then + prevPage = BuildPageButton("<", -1, EllesmereUI.L("Previous sockets")) + nextPage = BuildPageButton(">", 1, EllesmereUI.L("Next sockets")) + prevPage:SetPoint("LEFT", panel, "LEFT", 0, 0) + nextPage:SetPoint("RIGHT", panel, "RIGHT", 0, 0) + end + if prevPage then + prevPage:SetShown(paged) + nextPage:SetShown(paged) + prevPage:SetEnabled(socketPage > 0) + nextPage:SetEnabled(socketPage < last) + prevPage:SetAlpha(socketPage > 0 and 1 or 0.3) + nextPage:SetAlpha(socketPage < last and 1 or 0.3) + end + -- Hide all pooled icons first. for _, btn in ipairs(iconPool) do btn:Hide() btn.euiSock = nil end - local count = #sockets if count == 0 then panel:Hide() if EllesmereUI and EllesmereUI._updateCharSheetDurability then @@ -615,9 +683,8 @@ RebuildSockets = function() return end - -- One row, never wraps; the panel's right edge stays pinned so the row - -- grows leftward into the strip. - for i, rec in ipairs(sockets) do + for i = 1, visible do + local rec = sockets[first + i] local btn = AcquireIcon(i) btn.euiSock = rec if rec.gemLink then @@ -626,11 +693,12 @@ RebuildSockets = function() PaintEmptyIcon(btn) end btn:ClearAllPoints() - btn:SetPoint("LEFT", panel, "LEFT", (i - 1) * (SIZE + PAD), 0) + btn:SetPoint("LEFT", panel, "LEFT", + (paged and (PAGE_BUTTON_W + PAD) or 0) + (i - 1) * (SIZE + PAD), 0) btn:Show() end - panel:SetWidth(count * (SIZE + PAD) - PAD) + panel:SetWidth((paged and MAX_SOCKET_ICONS or visible) * (SIZE + PAD) - PAD) panel:Show() if EllesmereUI and EllesmereUI._updateCharSheetDurability then EllesmereUI._updateCharSheetDurability() diff --git a/EllesmereUILocales/_keys.txt b/EllesmereUILocales/_keys.txt index e4e971518..5b68e4a7d 100644 --- a/EllesmereUILocales/_keys.txt +++ b/EllesmereUILocales/_keys.txt @@ -1,6 +1,6 @@ # Auto-generated by .tools/extract-locale-keys.sh -- do not edit by hand. # Canonical list of translatable English keys passed as string literals -# (789 unique). Regenerate after wrapping new strings. Keys passed as +# (791 unique). Regenerate after wrapping new strings. Keys passed as # variables are not listed here -- use the in-game /euiloc harvester for # the complete runtime set. (Raid) @@ -455,6 +455,7 @@ New Custom Category New Filter New Patch Reminder Dot New Profile +Next sockets No No Bars - Click to Add No Items @@ -522,6 +523,7 @@ Preview Preview Mode Previewing Override: %1$s Previewing Overrides: %1$s, %2$s +Previous sockets Processing Profession %1$d Profile