/
local _G = _G |
local mover = CreateFrame("Frame", nil, UIParent) |
mover:SetBackdrop({bgFile ="Interface\\Buttons\\WHITE8x8",}) |
mover:SetBackdropColor(.2,.2,.9) |
mover:SetBackdropColor(.2,.2,.9,.6) |
mover:SetMovable(1) |
mover:Hide() |
local moverText = mover:CreateFontString(nil, "OVERLAY") |
mover:Show() |
moverText:SetText(frame) |
mover:EnableMouse(1) |
local r,p,a,x,y = _G[frame]:GetPoint() |
local height = _G[frame]:GetHeight() |
local width = _G[frame]:GetWidth() |
local frscale = _G[frame]:GetScale() |
mover:SetHeight(height) |
mover:SetWidth(width) |
mover:SetScale(frscale) |
mover:ClearAllPoints() |
mover:SetPoint(r,p,a,x,y) |
mover:SetAllPoints(frame) |
end |
end |
local function SetPosition(frame) |
if mover:IsShown() then |
local r,p,a,x,y = mover:GetPoint() |
PocketPlotDB[frame] = {["r"]=r, ["a"]=a,["x"]=x,["y"]=y} |
--frames lose their reference anchor frame when dragging... :/ |
if movershown == "Minimap" then |
p = "UIParent" |
else |
p = "MinimapCluster" |
end |
PocketPlotDB[frame] = {["r"]=r, ["p"]=p,["a"]=a,["x"]=x,["y"]=y} |
end |
_G[frame]:ClearAllPoints() |
_G[frame]:SetPoint(PocketPlotDB[frame].r, UIParent, PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y) |
_G[frame]:SetPoint(PocketPlotDB[frame].r, _G[PocketPlotDB[frame].p], PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y) |
if not _G["PP_old"..frame] then |
_G["PP_old"..frame] = _G[frame].SetPoint |
_G[frame].SetPoint = function(self, a,b,c,d,e, ...) |
local a,b,c,d,e = PocketPlotDB[frame].r, UIParent, PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y |
local a,b,c,d,e = PocketPlotDB[frame].r, _G[PocketPlotDB[frame].p], PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y |
return _G["PP_old"..frame](self, a,b,c,d,e, ...) |
end |
end |
end |
local function ConfirmPopup() |
if not StaticPopupDialogs["POCKETPLOT_RESET"] then |
StaticPopupDialogs["POCKETPLOT_RESET"] = { |
text = "Are you sure you want to reset these frames and reload your UI?", |
button1 = "Yes", |
button2 = "No", |
OnAccept = function() |
for i=1, #frames do |
PocketPlotDB[frames[i]] = nil |
end |
ReloadUI() |
end, |
timeout = 0, |
whileDead = 1, |
hideOnEscape = 1 |
} |
end |
StaticPopup_Show("POCKETPLOT_RESET") |
end |
local options = { |
name = "PocketPlot Options", |
type = "group", |
name = "Restore Positions", |
desc = "Clicking this will restore all frames to their default positions.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!", |
type = "execute", |
func = function() ConfirmPopup() end, |
order = 16, |
}, |
nudgeL = { |
name = "Nudge Left", |
desc = "Click to nudge the frame 1px to the left.", |
type = "execute", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
for i=1, #frames do |
PocketPlotDB[frames[i]] = nil |
if not PocketPlotDB[movershown] then |
SetPosition(movershown) |
end |
ReloadUI() |
local frame = _G[movershown] |
PocketPlotDB[movershown].x = PocketPlotDB[movershown].x - 1 |
frame:ClearAllPoints() |
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end, |
order = 16, |
order = 17, |
}, |
nudgeR = { |
name = "Nudge Right", |
desc = "Click to nudge the frame 1px to the right.", |
type = "execute", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not PocketPlotDB[movershown] then |
SetPosition(movershown) |
end |
local frame = _G[movershown] |
PocketPlotDB[movershown].x = PocketPlotDB[movershown].x + 1 |
frame:ClearAllPoints() |
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end, |
order = 18, |
}, |
nudgeU = { |
name = "Nudge Up", |
desc = "Click to nudge the frame 1px towards the top of the screen.", |
type = "execute", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not PocketPlotDB[movershown] then |
SetPosition(movershown) |
end |
local frame = _G[movershown] |
PocketPlotDB[movershown].y = PocketPlotDB[movershown].y + 1 |
frame:ClearAllPoints() |
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end, |
order = 19, |
}, |
nudgeD = { |
name = "Nudge Down", |
desc = "Click to nudge the frame 1px towards the bottom of the screen.", |
type = "execute", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not PocketPlotDB[movershown] then |
SetPosition(movershown) |
end |
local frame = _G[movershown] |
PocketPlotDB[movershown].y = PocketPlotDB[movershown].y - 1 |
frame:ClearAllPoints() |
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end, |
order = 20, |
}, |
}, |
} |
## Title: PocketPlot |
## Author: Seerah |
## Notes: Minimap customization |
## Version: 2.6.1 |
## Version: 2.7 |
## X-Category: Minimap |
## OptionalDeps: Ace3, LibSharedMedia-3.0 |
## SavedVariables: PocketPlotDB |