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
+6 -2
View File
@@ -17,7 +17,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
-- hook SetMapToCurrentZone to allow suppression -- hook SetMapToCurrentZone to allow suppression
local pfOrigSetMapToCurrentZone = _G.SetMapToCurrentZone local pfOrigSetMapToCurrentZone = _G.SetMapToCurrentZone
_G.SetMapToCurrentZone = function() _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() pfOrigSetMapToCurrentZone()
end end
@@ -61,6 +61,9 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
-- set back to default scale -- set back to default scale
WorldMapFrame:SetScale(scale or .85) WorldMapFrame:SetScale(scale or .85)
-- always switch to current zone when opening the map
pfOrigSetMapToCurrentZone()
end) end)
HookScript(WorldMapFrame, "OnMouseWheel", function() HookScript(WorldMapFrame, "OnMouseWheel", function()
@@ -129,7 +132,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
CreateBackdrop(btn, nil, true) CreateBackdrop(btn, nil, true)
btn:SetWidth(14) btn:SetWidth(14)
btn:SetHeight(14) btn:SetHeight(14)
btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 0) btn:SetPoint("RIGHT", WorldMapContinentDropDown, "LEFT", -8, 2)
btn.text:ClearAllPoints() btn.text:ClearAllPoints()
btn.text:SetPoint("RIGHT", btn, "LEFT", -4, 1) btn.text:SetPoint("RIGHT", btn, "LEFT", -4, 1)
btn.text:SetJustifyH("RIGHT") btn.text:SetJustifyH("RIGHT")
@@ -140,6 +143,7 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
btn:SetScript("OnClick", function() btn:SetScript("OnClick", function()
if this:GetChecked() then if this:GetChecked() then
C.appearance.worldmap.autozoneswitch = "1" C.appearance.worldmap.autozoneswitch = "1"
pfOrigSetMapToCurrentZone()
else else
C.appearance.worldmap.autozoneswitch = "0" C.appearance.worldmap.autozoneswitch = "0"
end end