From 08978b6b8ceb347cd694ea7c4c417a07cd9ad0b5 Mon Sep 17 00:00:00 2001 From: Steven Mey Date: Mon, 2 Dec 2019 23:52:31 +0100 Subject: [PATCH] Fixed some bugs with frame placement --- D2Minimap.lua | 95 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/D2Minimap.lua b/D2Minimap.lua index eb245af..4e6abd0 100644 --- a/D2Minimap.lua +++ b/D2Minimap.lua @@ -1,43 +1,66 @@ D2Minimap = true D2MinimapSettings = { - ["Frames"] = { - ["Minimap"] = { - ["Shown"] = true, - ["Zoom"] = 5, - ["PlayerArrow"] = false, - ["MaskSquare"] = false, - ["Alpha"] = .1, - }, - ["MinimapZoneTextButton"] = { - ["Alpha"] = .3, - }, - ["MinimapBorderTop"] = { - ["Alpha"] = 1, - }, - ["TimeManagerClockButton"] = { - ["Alpha"] = .3, - }, - ["MiniMapWorldMapButton"] = { - ["Alpha"] = .8, - }, - ["MiniMapTracking"] = { - ["Alpha"] = .2, - }, - ["MiniMapMailFrame"] = { - ["Alpha"] = .5, - }, - ["GarrisonLandingPageMinimapButton"] = { - ["Alpha"] = .2, - }, - }, + ["Frames"] = { + ["MinimapBorderTop"] = { + ["Alpha"] = 1, + ["Point"] = { + }, + }, + ["MinimapZoneTextButton"] = { + ["Alpha"] = 0.3, + ["Point"] = { + }, + }, + ["MiniMapWorldMapButton"] = { + ["Alpha"] = 0.8, + ["Point"] = { + }, + }, + ["MiniMapTracking"] = { + ["Alpha"] = 0.2, + ["Point"] = { + }, + }, + ["GarrisonLandingPageMinimapButton"] = { + ["Alpha"] = 0.2, + ["Point"] = { + ["yOfs"] = 0, + ["xOfs"] = 0, + ["point"] = "TOPRIGHT", + ["relativePoint"] = "TOPRIGHT", + }, + }, + ["MiniMapMailFrame"] = { + ["Alpha"] = 0.5, + ["Point"] = { + }, + }, + ["TimeManagerClockButton"] = { + ["Alpha"] = 0.3, + ["Point"] = { + }, + }, + ["Minimap"] = { + ["Zoom"] = 5, + ["Point"] = { + }, + ["Shown"] = true, + ["PlayerArrow"] = false, + ["Alpha"] = 0.1, + ["MaskSquare"] = false, + }, + }, } function D2Minimap_load() for frame, ftable in pairs(D2MinimapSettings["Frames"]) do - pcall(function() + pcall(function() _G[frame]:SetAlpha(ftable["Alpha"]) + end) + pcall(function() p = ftable["Point"] + _G[frame]:ClearAllPoints() _G[frame]:SetPoint(p.point, p.relativeTo, p.relativePoint, p.xOfs, p.yOfs) end) end @@ -45,14 +68,17 @@ end function D2Minimap_save() for frame, ftable in pairs(D2MinimapSettings["Frames"]) do - if not frame == "" then + if frame ~= "" then + ftable["Alpha"] = _G[frame]:GetAlpha() pcall(function() - ftable["Alpha"] = _G[frame]:GetAlpha() p = {} p.point, p.relativeTo, p.relativePoint, p.xOfs, p.yOfs = _G[frame]:GetPoint() + pcall(function() + p.relativeFrame = p.relativeTo:GetName() + end) ftable["Point"] = p end) - end + end end D2MinimapSettings["Frames"]["Minimap"]["Shown"] = Minimap:IsShown() D2MinimapSettings["Frames"]["Minimap"]["Zoom"] = Minimap:GetZoom() @@ -147,7 +173,6 @@ local function D2Minimap_init(self, event, addon, ...) Minimap:Hide() end end - if (event == "ADDON_LOADED") then D2Minimap_load() end -- 1.7.9.5