Created
July 29, 2019 12:10
-
-
Save Wetxius/66c2dd1947fcadc67126cb00b6e1a5be to your computer and use it in GitHub Desktop.
ShestakUI\Modules\Blizzard\UIWidget.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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