Files

50 lines
1.9 KiB
Lua

-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
-- Octo patch-5 WorldMapFrame.lua:703-753 adds this world-view Icepoint box.
-- Use the original native canvas extension before its normal map navigation.
WoWHybridUI = WoWHybridUI or {}
local owner = WoWHybridUI.sourceMapNavigation or {}
WoWHybridUI.sourceMapNavigation = owner
local function removeHandler()
if owner.canvas and owner.handler then
owner.canvas:RemoveCanvasClickHandler(owner.handler, owner.priority)
end
owner.canvas, owner.handler, owner.priority = nil, nil, nil
end
local function handleSourceMapClick(canvas, button, x, y)
if button ~= "LeftButton" or canvas:GetMapID() ~= 947 then return false end
if type(x) ~= "number" or type(y) ~= "number" or
not (x >= 0.325 and x <= 0.360 and y >= 0.010 and y <= 0.052) then
return false
end
-- Read current metadata at the click; absent or unrelated data falls through.
local target = C_Map and C_Map.GetMapInfo and C_Map.GetMapInfo(9011)
if not target or target.mapID ~= 9011 or target.parentMapID ~= 1414 then
return false
end
canvas:SetMapID(9011)
return true
end
local function installHandler()
local canvas = WorldMapFrame
if not canvas or type(canvas.AddCanvasClickHandler) ~= "function" or
type(canvas.RemoveCanvasClickHandler) ~= "function" then return end
removeHandler()
owner.canvas, owner.handler, owner.priority = canvas, handleSourceMapClick, 100
canvas:AddCanvasClickHandler(owner.handler, owner.priority)
end
if EventUtil and EventUtil.ContinueOnAddOnLoaded then
EventUtil.ContinueOnAddOnLoaded("Blizzard_WorldMap", installHandler)
end
if not owner.events then
owner.events = CreateFrame("Frame")
owner.events:RegisterEvent("PLAYER_LOGOUT")
owner.events:SetScript("OnEvent", removeHandler)
end