worldmap-window: hooks should only be applied once

This commit is contained in:
shagu
2022-10-05 19:35:01 +02:00
parent 22c1b790af
commit 55e313588e
+29 -24
View File
@@ -29,34 +29,39 @@ module.enable = function(self)
UIPanelWindows["WorldMapFrame"] = { area = "center" }
HookScript(WorldMapFrame, "OnShow", function()
-- default events
UpdateMicroButtons()
PlaySound("igQuestLogOpen")
CloseDropDownMenus()
SetMapToCurrentZone()
WorldMapFrame_PingPlayerPosition()
-- make sure the hooks get only applied once
if not this.hooked then
this.hooked = true
-- customize
this:EnableKeyboard(false)
this:EnableMouseWheel(1)
end)
HookScript(WorldMapFrame, "OnShow", function()
-- default events
UpdateMicroButtons()
PlaySound("igQuestLogOpen")
CloseDropDownMenus()
SetMapToCurrentZone()
WorldMapFrame_PingPlayerPosition()
HookScript(WorldMapFrame, "OnMouseWheel", function()
if IsShiftKeyDown() then
WorldMapFrame:SetAlpha(WorldMapFrame:GetAlpha() + arg1/10)
elseif IsControlKeyDown() then
WorldMapFrame:SetScale(WorldMapFrame:GetScale() + arg1/10)
end
end)
-- customize
this:EnableKeyboard(false)
this:EnableMouseWheel(1)
end)
HookScript(WorldMapFrame, "OnMouseDown",function()
WorldMapFrame:StartMoving()
end)
HookScript(WorldMapFrame, "OnMouseWheel", function()
if IsShiftKeyDown() then
WorldMapFrame:SetAlpha(WorldMapFrame:GetAlpha() + arg1/10)
elseif IsControlKeyDown() then
WorldMapFrame:SetScale(WorldMapFrame:GetScale() + arg1/10)
end
end)
HookScript(WorldMapFrame, "OnMouseUp",function()
WorldMapFrame:StopMovingOrSizing()
end)
HookScript(WorldMapFrame, "OnMouseDown",function()
WorldMapFrame:StartMoving()
end)
HookScript(WorldMapFrame, "OnMouseUp",function()
WorldMapFrame:StopMovingOrSizing()
end)
end
WorldMapFrame:SetMovable(true)
WorldMapFrame:EnableMouse(true)