Update LibDBIcon

This commit is contained in:
Robin Hüskes 2022-12-03 17:20:17 +01:00
parent fdd8d7edc3
commit 8ed23ca329
1 changed files with 38 additions and 26 deletions

View File

@ -1,4 +1,4 @@
--@curseforge-project-slug: libdbicon-1-0@
-----------------------------------------------------------------------
-- LibDBIcon-1.0
--
@ -6,7 +6,7 @@
--
local DBICON10 = "LibDBIcon-1.0"
local DBICON10_MINOR = 44 -- Bump on changes
local DBICON10_MINOR = 45 -- Bump on changes
if not LibStub then error(DBICON10 .. " requires LibStub.") end
local ldb = LibStub("LibDataBroker-1.1", true)
if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
@ -218,37 +218,49 @@ local function createButton(name, object, db)
button.dataObject = object
button.db = db
button:SetFrameStrata("MEDIUM")
if button.SetFixedFrameStrata then -- Classic support
button:SetFixedFrameStrata(true)
end
button:SetFixedFrameStrata(true)
button:SetFrameLevel(8)
if button.SetFixedFrameLevel then -- Classic support
button:SetFixedFrameLevel(true)
end
button:SetFixedFrameLevel(true)
button:SetSize(31, 31)
button:RegisterForClicks("anyUp")
button:RegisterForDrag("LeftButton")
button:SetHighlightTexture(136477) --"Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight"
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(53, 53)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT")
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(20, 20)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("TOPLEFT", 7, -5)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(17, 17)
icon:SetTexture(object.icon)
icon:SetPoint("TOPLEFT", 7, -6)
button.icon = icon
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(50, 50)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(24, 24)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("CENTER", button, "CENTER", 0, 1)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(18, 18)
icon:SetTexture(object.icon)
icon:SetPoint("CENTER", button, "CENTER", 0, 1)
button.icon = icon
else
local overlay = button:CreateTexture(nil, "OVERLAY")
overlay:SetSize(53, 53)
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
overlay:SetPoint("TOPLEFT")
local background = button:CreateTexture(nil, "BACKGROUND")
background:SetSize(20, 20)
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
background:SetPoint("TOPLEFT", 7, -5)
local icon = button:CreateTexture(nil, "ARTWORK")
icon:SetSize(17, 17)
icon:SetTexture(object.icon)
icon:SetPoint("TOPLEFT", 7, -6)
button.icon = icon
end
button.isMouseDown = false
local r, g, b = button.icon:GetVertexColor()
button.icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
local r, g, b = icon:GetVertexColor()
icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
icon.UpdateCoord = updateCoord
icon:UpdateCoord()
button.icon.UpdateCoord = updateCoord
button.icon:UpdateCoord()
button:SetScript("OnEnter", onEnter)
button:SetScript("OnLeave", onLeave)