switch map to current zone when opening the map

This commit is contained in:
Meow
2026-03-16 15:45:04 +01:00
parent 75c97c6e59
commit fce239349c
+7 -3
View File
@@ -17,7 +17,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
-- hook SetMapToCurrentZone to allow suppression
local pfOrigSetMapToCurrentZone = _G.SetMapToCurrentZone
_G.SetMapToCurrentZone = function()
if C.appearance.worldmap.autozoneswitch == "0" then return end
if C.appearance.worldmap.autozoneswitch == "0" and WorldMapFrame:IsShown() then return end
pfOrigSetMapToCurrentZone()
end
@@ -61,6 +61,9 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
-- set back to default scale
WorldMapFrame:SetScale(scale or .85)
-- always switch to current zone when opening the map
pfOrigSetMapToCurrentZone()
end)
HookScript(WorldMapFrame, "OnMouseWheel", function()
@@ -129,7 +132,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
CreateBackdrop(btn, nil, true)
btn:SetWidth(14)
btn:SetHeight(14)
btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 0)
btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 2)
btn.text:ClearAllPoints()
btn.text:SetPoint("RIGHT", btn, "LEFT", -4, 1)
btn.text:SetJustifyH("RIGHT")
@@ -140,6 +143,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
btn:SetScript("OnClick", function()
if this:GetChecked() then
C.appearance.worldmap.autozoneswitch = "1"
pfOrigSetMapToCurrentZone()
else
C.appearance.worldmap.autozoneswitch = "0"
end
@@ -186,4 +190,4 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
end)
pfUI.map.loader = pfMapLoader
end)
end)