聊天重做前缓存
This commit is contained in:
64
Minimap.lua
64
Minimap.lua
@@ -93,6 +93,19 @@ local function GetDB()
|
||||
return db
|
||||
end
|
||||
|
||||
local function IsMapStateProtected()
|
||||
if WorldMapFrame and WorldMapFrame:IsVisible() then
|
||||
return true
|
||||
end
|
||||
if BattlefieldMinimap and BattlefieldMinimap:IsVisible() then
|
||||
return true
|
||||
end
|
||||
if BattlefieldMinimapFrame and BattlefieldMinimapFrame:IsVisible() then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function ResolveStyleKey()
|
||||
local key = GetDB().mapStyle or "auto"
|
||||
if key == "auto" then
|
||||
@@ -152,6 +165,34 @@ local function ApplyPosition()
|
||||
end
|
||||
end
|
||||
|
||||
local function HideTooltipIfOwned(frame)
|
||||
if not frame or not GameTooltip or not GameTooltip:IsVisible() then
|
||||
return
|
||||
end
|
||||
if GameTooltip.IsOwned and GameTooltip:IsOwned(frame) then
|
||||
GameTooltip:Hide()
|
||||
return
|
||||
end
|
||||
if GameTooltip.GetOwner and GameTooltip:GetOwner() == frame then
|
||||
GameTooltip:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function ForceHideMinimapFrame(frame)
|
||||
if not frame then return end
|
||||
HideTooltipIfOwned(frame)
|
||||
if frame.EnableMouse then
|
||||
frame:EnableMouse(false)
|
||||
end
|
||||
if frame.Hide then
|
||||
frame:Hide()
|
||||
end
|
||||
if frame.SetAlpha then
|
||||
frame:SetAlpha(0)
|
||||
end
|
||||
frame.Show = function() end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Hide default Blizzard minimap chrome
|
||||
-- MUST be called AFTER BuildFrame (Minimap is already reparented)
|
||||
@@ -165,15 +206,13 @@ local function HideDefaultElements()
|
||||
MinimapToggleButton,
|
||||
MiniMapWorldMapButton,
|
||||
GameTimeFrame,
|
||||
TimeManagerClockButton,
|
||||
MinimapZoneTextButton,
|
||||
MiniMapTracking,
|
||||
MinimapBackdrop,
|
||||
}
|
||||
for _, f in ipairs(kill) do
|
||||
if f then
|
||||
f:Hide()
|
||||
f.Show = function() end
|
||||
end
|
||||
ForceHideMinimapFrame(f)
|
||||
end
|
||||
|
||||
-- Hide all tracking-related frames (Turtle WoW dual tracking, etc.)
|
||||
@@ -183,10 +222,7 @@ local function HideDefaultElements()
|
||||
}
|
||||
for _, name in ipairs(trackNames) do
|
||||
local f = _G[name]
|
||||
if f and f.Hide then
|
||||
f:Hide()
|
||||
f.Show = function() end
|
||||
end
|
||||
ForceHideMinimapFrame(f)
|
||||
end
|
||||
|
||||
-- Also hide any tracking textures that are children of Minimap
|
||||
@@ -195,8 +231,7 @@ local function HideDefaultElements()
|
||||
for _, child in ipairs(children) do
|
||||
local n = child.GetName and child:GetName()
|
||||
if n and string.find(n, "Track") then
|
||||
child:Hide()
|
||||
child.Show = function() end
|
||||
ForceHideMinimapFrame(child)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -455,8 +490,15 @@ local function UpdateZoneText()
|
||||
end
|
||||
|
||||
local function SetZoneMap()
|
||||
if IsMapStateProtected() then
|
||||
return
|
||||
end
|
||||
if SetMapToCurrentZone then
|
||||
pcall(SetMapToCurrentZone)
|
||||
if SFrames and SFrames.CallWithPreservedBattlefieldMinimap then
|
||||
SFrames:CallWithPreservedBattlefieldMinimap(SetMapToCurrentZone)
|
||||
else
|
||||
pcall(SetMapToCurrentZone)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user