diff --git a/Modules/QuestieLearner.lua b/Modules/QuestieLearner.lua index 9a60625..90493f5 100644 --- a/Modules/QuestieLearner.lua +++ b/Modules/QuestieLearner.lua @@ -4628,24 +4628,13 @@ local function _ApplyElvUIStyleTooltip(frame) return end end - -- ElvUI "Transparent" template — see ElvUI/Core/Toolkit.lua SetTemplate and - -- ElvUI/Settings/Profile.lua:29-31. ElvUI uses a FLAT texture for both the - -- background and the border with a 1px (E.mult) edge, NOT the chunky default - -- WoW tooltip border — so use a solid texture and edgeSize 1 to match. + -- Without ElvUI: apply the exact ElvUI "Transparent" template via the shared skinner + -- (WHITE8X8 texture, 1-physical-pixel edge, backdropfadecolor + black border). if not frame.SetBackdrop then return end - local FLAT = "Interface\\ChatFrame\\ChatFrameBackground" -- solid 1x1 texture on 3.3.5 - frame:SetBackdrop({ - bgFile = FLAT, - edgeFile = FLAT, - tile = false, - tileSize = 0, - edgeSize = 1, - insets = {left = 0, right = 0, top = 0, bottom = 0}, - }) - -- (0.06, 0.06, 0.06, 0.8) — ElvUI's default backdropfadecolor - frame:SetBackdropColor(0.06, 0.06, 0.06, 0.8) - -- Black border (ElvUI's default bordercolor is {0, 0, 0}) - frame:SetBackdropBorderColor(0, 0, 0, 1) + local QuestieTooltips = QuestieLoader:ImportModule("QuestieTooltips") + if QuestieTooltips and QuestieTooltips.ApplyElvUISkin then + QuestieTooltips:ApplyElvUISkin(frame) + end -- Apply the same font ElvUI uses by default. FontTemplate isn't available -- without ElvUI, so set font + shadow directly. diff --git a/Modules/Tooltips/Tooltip.lua b/Modules/Tooltips/Tooltip.lua index a20e7f6..e723878 100644 --- a/Modules/Tooltips/Tooltip.lua +++ b/Modules/Tooltips/Tooltip.lua @@ -671,24 +671,47 @@ _InitObjectiveTexts = function(objectivesText, objectiveIndex, playerName) return objectivesText end --- Apply ElvUI's "Transparent" tooltip look (flat dark background + thin 1px border) so --- Questie's tooltips match the ElvUI style even when ElvUI is not installed. ElvUI uses a --- FLAT texture for both the background and the border with a 1px edge (see --- ElvUI/Core/Toolkit.lua SetTemplate + Settings/Profile.lua:29-31), not the chunky default --- WoW tooltip border. -local _ELV_FLAT = "Interface\\ChatFrame\\ChatFrameBackground" -- solid 1x1 texture on 3.3.5 -local function _ApplyElvUIStyle(frame) +-- Apply ElvUI's "Transparent" tooltip template (flat dark background + a true 1px border) +-- so Questie's tooltips match the ElvUI style even when ElvUI is not installed. This copies +-- ElvUI/Core/Toolkit.lua SetTemplate: the exact blank texture (E.media.blankTex = +-- Interface\Buttons\WHITE8X8) for both bg and edge, edgeSize = E.mult (ONE physical pixel), +-- backdrop = E.media.backdropfadecolor {0.06,0.06,0.06} @ colorAlpha 0.8, border = +-- E.media.bordercolor {0,0,0}. Using E.mult instead of a 1-unit edge is what keeps the +-- border thin and even (a 1-unit edge renders several pixels thick at the user's UI scale). +local _ELV_FLAT = "Interface\\Buttons\\WHITE8X8" -- E.media.blankTex + +-- ElvUI's E.mult: the size, in UI units, of one physical screen pixel. ElvUI scales UIParent +-- so 1 unit == 1px; without ElvUI we derive the same value: (768 / screenHeight) / uiScale. +local function _PixelMult() + local scale = UIParent:GetScale() + if (not scale) or scale <= 0 then scale = 1 end + local res = GetCVar and GetCVar("gxResolution") + local screenHeight = res and tonumber(string.match(res, "%d+x(%d+)")) + if (not screenHeight) or screenHeight <= 0 then + screenHeight = (GetScreenHeight and GetScreenHeight() * scale) or 768 + end + local mult = (768 / screenHeight) / scale + if (not mult) or mult <= 0 then mult = 1 end + return mult +end + +function QuestieTooltips:ApplyElvUISkin(frame) if not frame or not frame.SetBackdrop then return end + local mult = _PixelMult() frame:SetBackdrop({ bgFile = _ELV_FLAT, edgeFile = _ELV_FLAT, tile = false, tileSize = 0, - edgeSize = 1, + edgeSize = mult, insets = { left = 0, right = 0, top = 0, bottom = 0 }, }) - frame:SetBackdropColor(0.06, 0.06, 0.06, 0.8) -- ElvUI backdropfadecolor - frame:SetBackdropBorderColor(0, 0, 0, 1) -- ElvUI bordercolor (black) + frame:SetBackdropColor(0.06, 0.06, 0.06, 0.8) -- backdropfadecolor @ colorAlpha + frame:SetBackdropBorderColor(0, 0, 0, 1) -- bordercolor (black) +end + +local function _ApplyElvUIStyle(frame) + QuestieTooltips:ApplyElvUISkin(frame) end -- Skins the standard tooltip frames Questie writes into. No-op when ElvUI is loaded (it