fix(tooltip): copy ElvUI's exact tooltip border (pixel-perfect, even)
The previous ElvUI-style border was too thick and uneven (thicker at the
top): it used Interface\ChatFrame\ChatFrameBackground with edgeSize = 1 UI
*unit*, which renders several physical pixels thick at the user's UI scale,
and a 1x1 texture that samples unevenly along edges.
Now copies ElvUI/Core/Toolkit.lua SetTemplate exactly: the blank texture
E.media.blankTex (Interface\Buttons\WHITE8X8) for bg + edge, and edgeSize =
E.mult (one physical pixel = (768 / screenHeight) / uiScale) so the border
is a true even 1px. Colors unchanged (ElvUI defaults the user runs):
backdropfadecolor {0.06,0.06,0.06} @ colorAlpha 0.8, bordercolor black.
Factored into QuestieTooltips:ApplyElvUISkin so the secondary learner frame
and the default tooltips share one implementation.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user