Skip to content

Commit

Permalink
Full support for the shadowlands 'HybridMinimap' should now be complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Oct 29, 2020
1 parent 2b29965 commit 9e2fdf8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 38 deletions.
77 changes: 45 additions & 32 deletions Borders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -950,43 +950,56 @@ function mod:SavePresetAs(name)
self:RebuildPresets()
end

local inc = 0
function mod:CreateBorderFromParams(t)
inc = inc + 1
local tex = tremove(texturePool) or Minimap:CreateTexture()
tex:SetTexture(t.texture)
tex:SetBlendMode(t.blendMode or "ADD")
tex:SetVertexColor(t.r or 1, t.g or 1, t.b or 1, t.a or 1)
tex:SetPoint("CENTER", Minimap, "CENTER", t.hNudge or 0, t.vNudge or 0)
tex:SetWidth((t.width or defaultSize) * (t.scale or 1))
tex:SetHeight((t.height or defaultSize) * (t.scale or 1))
tex:SetDrawLayer(t.drawLayer or "ARTWORK")
do
local inc = 0
local backgroundFrame = CreateFrame("Frame") -- HybridMinimap compat
backgroundFrame:SetParent(Minimap)
backgroundFrame:SetFrameStrata("BACKGROUND")
backgroundFrame:SetFrameLevel(1)
backgroundFrame:Show()
function mod:CreateBorderFromParams(t)
inc = inc + 1
local tex = tremove(texturePool) or Minimap:CreateTexture()

tex.rotSpeed = t.rotSpeed or 0
tex.settings = t
tex:Show()
if t.disableRotation then
tex:SetTexCoord(0, 1, 0, 1)
else
if t.playerRotation and t.playerRotation ~= "none" then
rotateTextures[tex] = t.playerRotation
if t.drawLayer == "BACKGROUND" then -- Be compatible with HybridMinimap which sits at frame strata BACKGROUND level 100
tex:SetParent(backgroundFrame)
else
rotateTextures[tex] = t.rotSpeed ~= 0 and t.rotSpeed or nil
tex:SetParent(Minimap)
end
RotateTexture(tex, t.rotation or 0, true)
end
tex:SetTexture(t.texture)
tex:SetBlendMode(t.blendMode or "ADD")
tex:SetVertexColor(t.r or 1, t.g or 1, t.b or 1, t.a or 1)
tex:SetPoint("CENTER", Minimap, "CENTER", t.hNudge or 0, t.vNudge or 0)
tex:SetWidth((t.width or defaultSize) * (t.scale or 1))
tex:SetHeight((t.height or defaultSize) * (t.scale or 1))
tex:SetDrawLayer(t.drawLayer or "ARTWORK")

local r,g,b,a = t.r or 1, t.g or 1, t.b or 1, t.a or 1
tex:SetVertexColor(r,g,b,a)
textures["tex" .. inc] = tex
tex.rotSpeed = t.rotSpeed or 0
tex.settings = t
tex:Show()
if t.disableRotation then
tex:SetTexCoord(0, 1, 0, 1)
else
if t.playerRotation and t.playerRotation ~= "none" then
rotateTextures[tex] = t.playerRotation
else
rotateTextures[tex] = t.rotSpeed ~= 0 and t.rotSpeed or nil
end
RotateTexture(tex, t.rotation or 0, true)
end

options.args.currentGroup.args.borders.args["tex" .. inc] = {
type = "group",
name = t.name or ("Border #" .. inc),
arg = "tex" .. inc,
args = borderOptions
}
return tex
local r,g,b,a = t.r or 1, t.g or 1, t.b or 1, t.a or 1
tex:SetVertexColor(r,g,b,a)
textures["tex" .. inc] = tex

options.args.currentGroup.args.borders.args["tex" .. inc] = {
type = "group",
name = t.name or ("Border #" .. inc),
arg = "tex" .. inc,
args = borderOptions
}
return tex
end
end

function mod:ClearWidgets()
Expand Down
8 changes: 7 additions & 1 deletion SexyMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,18 @@ end
Minimap:SetParent(UIParent)
-- Undo the damage caused by automagic fuckery when a frame changes parent
-- In other words, restore the minimap defaults to what they were, when it was parented to MinimapCluster
Minimap:SetFrameStrata("LOW")
Minimap:SetFrameStrata("LOW") -- Blizz Defaults patch 9.0.1 Minimap.xml
Minimap:SetFrameLevel(1)
-- Make sure the various minimap buttons follow the minimap
-- We do this before login to prevent button placement issues
MinimapBackdrop:ClearAllPoints()
MinimapBackdrop:SetPoint("CENTER", Minimap, "CENTER", -8, -23)
-- This should never run as we should always load before it... unless someone force loads it early
-- If they did, the strata/level would also mess up from changing Minimap parent, so we restore it
if HybridMinimap then
HybridMinimap:SetFrameStrata("BACKGROUND") -- Blizz Defaults patch 9.0.1 Blizzard_HybridMinimap.xml
HybridMinimap:SetFrameLevel(100)
end

function mod:SetupMap()
local Minimap = Minimap
Expand Down
15 changes: 10 additions & 5 deletions Shapes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,17 @@ function mod:ApplyShape(shape)
sm.buttons:UpdateDraggables()
end

function sm.core:PLAYER_ENTERING_WORLD() -- XXX Investigate if it's safe to unregister this after the first application
if C_Minimap.ShouldUseHybridMinimap() then
mod:ApplyShape()
end
if not HybridMinimap then
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function(self, event, addon)
if addon == "Blizzard_HybridMinimap" then
self:UnregisterEvent(event)
mod:ApplyShape()
self:SetScript("OnEvent", nil)
end
end)
frame:RegisterEvent("ADDON_LOADED")
end
sm.core.frame:RegisterEvent("PLAYER_ENTERING_WORLD")

-- Global function for other addons
GetMinimapShape = function()
Expand Down

0 comments on commit 9e2fdf8

Please sign in to comment.