You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
MoveIt.Modules.Reposition = {}
|
|
|
|
function MoveIt.Modules.Reposition:Apply(frameName)
|
|
|
|
local modSettings = MoveIt:GetFrameSettings(frameName, "Reposition")
|
|
local handle = MoveIt:GetFrameHandle(frameName)
|
|
|
|
handle:ClearAllPoints()
|
|
handle:SetPoint(
|
|
modSettings.AnchorPointFrom,
|
|
MoveIt:GetFrameHandle(modSettings.AnchorTargetFrame),
|
|
modSettings.AnchorPointTo,
|
|
modSettings.OffsetX,
|
|
modSettings.OffsetY
|
|
)
|
|
|
|
end
|
|
|
|
function MoveIt.Modules.Reposition:Revert(frameName)
|
|
|
|
local originalSettings = MoveIt.originalSettings[frameName].Reposition
|
|
|
|
MoveIt:SetFrameSettings(frameName, "Reposition",
|
|
{
|
|
OffsetX = originalSettings.OffsetX,
|
|
OffsetY = originalSettings.OffsetY,
|
|
AnchorPointFrom = originalSettings.AnchorPointFrom,
|
|
AnchorPointTo = originalSettings.AnchorPointTo,
|
|
AnchorTargetFrame = originalSettings.AnchorTargetFrame,
|
|
Enabled = false
|
|
})
|
|
self:Apply(frameName)
|
|
|
|
end
|
|
|
|
function MoveIt.Modules.Reposition:GetOriginalSettings(frameName)
|
|
|
|
local handle = MoveIt:GetFrameHandle(frameName)
|
|
local point, relativeTo, relativePoint, xOfs, yOfs = handle:GetPoint()
|
|
local offsetX, offsetY = 0, 0
|
|
local anchorPointFrom = "CENTER"
|
|
local anchorPointTo = "CENTER"
|
|
local anchorTarget = "UIParent"
|
|
|
|
if xOfs ~= nil then offsetX = xOfs end
|
|
if yOfs ~= nil then offsetY = yOfs end
|
|
if point ~= nil then anchorPointFrom = point end
|
|
if relativePoint ~= nil then anchorPointTo = relativePoint end
|
|
if relativeTo ~= nil then
|
|
anchorTarget = MoveIt:GetFrameName(relativeTo)
|
|
elseif handle:GetParent() ~= nil then
|
|
anchorTarget = MoveIt:GetFrameName(handle:GetParent())
|
|
end
|
|
|
|
return
|
|
{
|
|
OffsetX = offsetX,
|
|
OffsetY = offsetY,
|
|
AnchorPointFrom = anchorPointFrom,
|
|
AnchorPointTo = anchorPointTo,
|
|
AnchorTargetFrame = anchorTarget
|
|
}
|
|
|
|
end
|