core: switch from mousedown to drag functions

Due to crashes/freezes while moving some frames, one possible
reason could be that pfUI was using OnMouseDown and OnMouseUp
to run its frame-moving code. I have noticed better performance
when using the intended functions, OnDragStart and OnDragStop
to move frames.

This commit changes every occurrence of such functions and splits
drag and click into seperate functions where required.
This commit is contained in:
shagu
2022-05-07 21:35:52 +02:00
parent c72c61c133
commit 0214eebf36
10 changed files with 59 additions and 47 deletions
+6 -5
View File
@@ -39,6 +39,10 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
UIPanelWindows["WorldMapFrame"] = { area = "center" }
WorldMapFrame:SetMovable(true)
WorldMapFrame:EnableMouse(true)
WorldMapFrame:RegisterForDrag("LeftButton")
WorldMapFrame:SetScript("OnShow", function()
-- default events
UpdateMicroButtons()
@@ -67,18 +71,15 @@ pfUI:RegisterModule("map", "vanilla:tbc", function ()
SaveMovable(this, true)
end)
WorldMapFrame:SetScript("OnMouseDown",function()
WorldMapFrame:SetScript("OnDragStart",function()
WorldMapFrame:StartMoving()
end)
WorldMapFrame:SetScript("OnMouseUp",function()
WorldMapFrame:SetScript("OnDragStop",function()
WorldMapFrame:StopMovingOrSizing()
SaveMovable(this, true)
end)
WorldMapFrame:SetMovable(true)
WorldMapFrame:EnableMouse(true)
WorldMapFrame:SetAlpha(alpha)
WorldMapFrame:SetScale(scale)
UpdateTooltipScale()