Skip to content

Instantly share code, notes, and snippets.

@Wetxius
Created July 29, 2019 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wetxius/66c2dd1947fcadc67126cb00b6e1a5be to your computer and use it in GitHub Desktop.
Save Wetxius/66c2dd1947fcadc67126cb00b6e1a5be to your computer and use it in GitHub Desktop.
ShestakUI\Modules\Blizzard\UIWidget.lua
local T, C, L, _ = unpack(select(2, ...))
----------------------------------------------------------------------------------------
-- UIWidget frame
----------------------------------------------------------------------------------------
local top = _G["UIWidgetTopCenterContainerFrame"]
top:ClearAllPoints()
top:SetPoint(unpack(C.position.uiwidget))
local below = _G["UIWidgetBelowMinimapContainerFrame"]
local function RepositionBelowFrame(_, _, parent)
if parent == "MinimapCluster" or parent == _G["MinimapCluster"] then
below:ClearAllPoints()
below:SetPoint(unpack(C.position.uiwidget))
end
end
RepositionBelowFrame()
hooksecurefunc(below, "SetPoint", RepositionBelowFrame)
for _, frame in pairs({top, below}) do
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetUserPlaced(true)
frame:SetScript("OnMouseDown", function(self, button)
if IsAltKeyDown() or IsShiftKeyDown() then
frame:ClearAllPoints()
frame:StartMoving()
elseif IsControlKeyDown() and button == "RightButton" then
frame:ClearAllPoints()
frame:SetPoint(unpack(C.position.uiwidget))
end
end)
frame:SetScript("OnMouseUp", function()
frame:StopMovingOrSizing()
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment