diff --git a/SVUI_!Core/system/api.lua b/SVUI_!Core/system/api.lua index 484bdb5..39457e5 100644 --- a/SVUI_!Core/system/api.lua +++ b/SVUI_!Core/system/api.lua @@ -164,6 +164,49 @@ end APPENDED POSITIONING METHODS ########################################################## ]]-- +local FIND_EDGES = { + CENTER = function(frame, x, y) + local xX,yY = frame:GetCenter(); + return (xX + x),(yY + y); + end, + TOP = function(frame, x, y) + local yY = frame:GetTop() - UIParent:GetHeight() + y; + return x,yY; + end, + TOPLEFT = function(frame, x, y) + local xX = frame:GetLeft() + x; + local yY = frame:GetTop() - UIParent:GetHeight() + y; + return xX,yY; + end, + TOPRIGHT = function(frame, x, y) + local xX = frame:GetRight() - UIParent:GetWidth() + x; + local yY = frame:GetTop() - UIParent:GetHeight() + y; + return xX,yY; + end, + BOTTOM = function(frame, x, y) + local yY = frame:GetBottom() + y; + return x,yY; + end, + BOTTOMLEFT = function(frame, x, y) + local xX = frame:GetLeft() + x; + local yY = frame:GetBottom() + y; + return xX,yY; + end, + BOTTOMRIGHT = function(frame, x, y) + local xX = frame:GetRight() - UIParent:GetWidth() + x; + local yY = frame:GetBottom() + y; + return xX,yY; + end, +}; + +local function GetRelativeEdges(frame, anchor) + local x,y = 0,0; + if(FIND_EDGES[anchor]) then + x,y = FIND_EDGES[anchor](frame); + end + return x,y; +end + local ModSize = function(self, width, height) if(type(width) == "number") then local h = (height and type(height) == "number") and height or width @@ -192,6 +235,14 @@ local InsetPoints = function(self, parent, x, y) self:SetPoint("TOPLEFT", parent, "TOPLEFT", x, -y) self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -x, y) end + +local SetSecurePoint = function(self, anchor1, parent, anchor2, x, y) + local pX,pY = x,y; + if(FIND_EDGES[anchor2]) then + pX,pY = FIND_EDGES[anchor2](parent, x, y); + end + self:SetPoint(anchor1, UIParent, anchor2, pX, pY); +end --[[ ########################################################## APPENDED DESTROY METHODS @@ -1294,71 +1345,70 @@ SCREEN HANDLER (IN DEVELOPMENT) function SV:UI_SCALE_CHANGED(event) local managedScale = self.db.screen.autoScale; local gxWidth, gxHeight, gxScale, customScale = ScreenUpdate(); - - if(managedScale) then - local needCalc = true; - if(self.db.screen.advanced) then - if(self.db.screen.forcedWidth ~= gxWidth) then - gxWidth = self.db.screen.forcedWidth - needCalc = false; - end - if(self.db.screen.forcedHeight ~= gxHeight) then - gxHeight = self.db.screen.forcedHeight - needCalc = false; + if(event == 'PLAYER_LOGIN' or event == 'UI_SCALE_CHANGED') then + if(managedScale) then + local needCalc = true; + if(self.db.screen.advanced) then + if(self.db.screen.forcedWidth ~= gxWidth) then + gxWidth = self.db.screen.forcedWidth + needCalc = false; + end + if(self.db.screen.forcedHeight ~= gxHeight) then + gxHeight = self.db.screen.forcedHeight + needCalc = false; + end end - end - if(needCalc) then - if(gxWidth < 1600) then - self.LowRez = true; - elseif(gxWidth >= 3840) then - self.LowRez = nil - local evalwidth; - if(self.db.screen.multiMonitor) then - if(gxWidth < 4080) then - evalwidth = 1224; - elseif(gxWidth < 4320) then - evalwidth = 1360; - elseif(gxWidth < 4680) then - evalwidth = 1400; - elseif(gxWidth < 4800) then - evalwidth = 1440; - elseif(gxWidth < 5760) then - if(gxHeight == 900) then evalwidth = 1600 else evalwidth = 1680 end - elseif(gxWidth < 7680) then - evalwidth = 1920; - elseif(gxWidth < 9840) then - evalwidth = 2560; - elseif(gxWidth > 9839) then - evalwidth = 3280; - end - else - if(gxWidth < 4080) then - evalwidth = 3840; - elseif(gxWidth < 4320) then - evalwidth = 4080; - elseif(gxWidth < 4680) then - evalwidth = 4320; - elseif(gxWidth < 4800) then - evalwidth = 4680; - elseif(gxWidth < 5040) then - evalwidth = 4800; - elseif(gxWidth < 5760) then - evalwidth = 5040; - elseif(gxWidth < 7680) then - evalwidth = 5760; - elseif(gxWidth < 9840) then - evalwidth = 7680; - elseif(gxWidth > 9839) then - evalwidth = 9840; + if(needCalc) then + if(gxWidth < 1600) then + self.LowRez = true; + elseif(gxWidth >= 3840) then + self.LowRez = nil + local evalwidth; + if(self.db.screen.multiMonitor) then + if(gxWidth < 4080) then + evalwidth = 1224; + elseif(gxWidth < 4320) then + evalwidth = 1360; + elseif(gxWidth < 4680) then + evalwidth = 1400; + elseif(gxWidth < 4800) then + evalwidth = 1440; + elseif(gxWidth < 5760) then + if(gxHeight == 900) then evalwidth = 1600 else evalwidth = 1680 end + elseif(gxWidth < 7680) then + evalwidth = 1920; + elseif(gxWidth < 9840) then + evalwidth = 2560; + elseif(gxWidth > 9839) then + evalwidth = 3280; + end + else + if(gxWidth < 4080) then + evalwidth = 3840; + elseif(gxWidth < 4320) then + evalwidth = 4080; + elseif(gxWidth < 4680) then + evalwidth = 4320; + elseif(gxWidth < 4800) then + evalwidth = 4680; + elseif(gxWidth < 5040) then + evalwidth = 4800; + elseif(gxWidth < 5760) then + evalwidth = 5040; + elseif(gxWidth < 7680) then + evalwidth = 5760; + elseif(gxWidth < 9840) then + evalwidth = 7680; + elseif(gxWidth > 9839) then + evalwidth = 9840; + end end - end - gxWidth = evalwidth; + gxWidth = evalwidth; + end end end - end - if(event == 'PLAYER_LOGIN' or event == 'UI_SCALE_CHANGED') then self.Screen:ClearAllPoints() self.Screen:SetPoint("CENTER") local ignoreChange = false; @@ -1421,9 +1471,7 @@ local function AppendFrameMethods(OBJECT) if not OBJECT.SetStyle then META.SetStyle = SetStyle end if not OBJECT.SetPanelColor then META.SetPanelColor = SetPanelColor end if not OBJECT.ModSize then META.ModSize = ModSize end - if not OBJECT.ModWidth then META.ModWidth = META.SetWidth end - if not OBJECT.ModHeight then META.ModHeight = META.SetHeight end - if not OBJECT.ModPoint then META.ModPoint = META.SetPoint end + if not OBJECT.SetSecurePoint then META.SetSecurePoint = SetSecurePoint end if not OBJECT.WrapPoints then META.WrapPoints = WrapPoints end if not OBJECT.InsetPoints then META.InsetPoints = InsetPoints end if not OBJECT.Die then META.Die = Die end @@ -1438,9 +1486,7 @@ end local function AppendTextureMethods(OBJECT) local META = getmetatable(OBJECT).__index if not OBJECT.ModSize then META.ModSize = ModSize end - if not OBJECT.ModWidth then META.ModWidth = META.SetWidth end - if not OBJECT.ModHeight then META.ModHeight = META.SetHeight end - if not OBJECT.ModPoint then META.ModPoint = META.SetPoint end + if not OBJECT.SetSecurePoint then META.SetSecurePoint = SetSecurePoint end if not OBJECT.WrapPoints then META.WrapPoints = WrapPoints end if not OBJECT.InsetPoints then META.InsetPoints = InsetPoints end if not OBJECT.Die then META.Die = Die end @@ -1452,9 +1498,7 @@ end local function AppendFontStringMethods(OBJECT) local META = getmetatable(OBJECT).__index if not OBJECT.ModSize then META.ModSize = ModSize end - if not OBJECT.ModWidth then META.ModWidth = META.SetWidth end - if not OBJECT.ModHeight then META.ModHeight = META.SetHeight end - if not OBJECT.ModPoint then META.ModPoint = META.SetPoint end + if not OBJECT.SetSecurePoint then META.SetSecurePoint = SetSecurePoint end if not OBJECT.WrapPoints then META.WrapPoints = WrapPoints end if not OBJECT.InsetPoints then META.InsetPoints = InsetPoints end end diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua index 338f621..d1de2d1 100644 --- a/SVUI_!Core/system/dock.lua +++ b/SVUI_!Core/system/dock.lua @@ -1497,23 +1497,15 @@ end local DockAlert_Activate = function(self, child, newHeight) local fallbackHeight = SV.db.Dock.buttonSize or 22; local size = newHeight or fallbackHeight; - child:ClearAllPoints() - child:SetAllPoints(self) - self.activeHeight = size; - if(InCombatLockdown()) then - self:RegisterEvent('PLAYER_REGEN_ENABLED') - else - self:SetHeight(size) + self:SetHeight(size); + if(child) then + child:ClearAllPoints() + child:SetAllPoints(self) end end local DockAlert_Deactivate = function(self) - self.activeHeight = 1; - if(InCombatLockdown()) then - self:RegisterEvent('PLAYER_REGEN_ENABLED') - else - self:SetHeight(1) - end + self:SetHeight(1) end local DockProxy_ResetAll = function(self, ...) @@ -1552,7 +1544,7 @@ for location, settings in pairs(DOCK_LOCATIONS) do MOD[location].Alert.Activate = DockAlert_Activate; MOD[location].Alert.Deactivate = DockAlert_Deactivate; - MOD[location].Alert:SetScript("OnEvent", DockAlert_OnEvent); + --MOD[location].Alert:SetScript("OnEvent", DockAlert_OnEvent); MOD[location].Bar.Parent = MOD[location]; MOD[location].Bar.SetDefault = DockBar_SetDefault; @@ -2109,6 +2101,8 @@ function MOD:Load() SV:SetAnchorResizing(dock.Bar, dockBarPostSizeFunc, 10, 500, 10, 80); SV:NewAnchor(dock, location .. " Dock Window"); SV:SetAnchorResizing(dock, dockPostSizeFunc, 10, 500); + + dock.Alert:SetParent(UIParent) end if MOD.private.LeftFaded then MOD.BottomLeft:Hide() end diff --git a/SVUI_QuestTracker/SVUI_QuestTracker.lua b/SVUI_QuestTracker/SVUI_QuestTracker.lua index e948d26..4557801 100644 --- a/SVUI_QuestTracker/SVUI_QuestTracker.lua +++ b/SVUI_QuestTracker/SVUI_QuestTracker.lua @@ -373,6 +373,7 @@ function MOD:UpdateDimensions() --MOD.Docklet.ScrollFrame.ScrollBar:SetHeight(scrollHeight); MOD.Docklet.ScrollFrame.ScrollChild:SetWidth(scrollWidth); MOD.Docklet.ScrollFrame.ScrollChild:SetHeight(totalHeight); + SV.Events:Trigger("QUEST_LAYOUT_UPDATED"); end local function ExpandQuestTracker(location) diff --git a/SVUI_QuestTracker/components/popups.lua b/SVUI_QuestTracker/components/popups.lua index 43b713b..79bb2c7 100644 --- a/SVUI_QuestTracker/components/popups.lua +++ b/SVUI_QuestTracker/components/popups.lua @@ -9,18 +9,6 @@ LOCALIZED LUA FUNCTIONS local _G = _G; local unpack = _G.unpack; local select = _G.select; ---BLIZZARD API -local CreateFrame = _G.CreateFrame; -local hooksecurefunc = _G.hooksecurefunc; -local ShowQuestOffer = _G.ShowQuestOffer; -local PlaySound = _G.PlaySound; -local GetQuestLogTitle = _G.GetQuestLogTitle; -local ShowQuestComplete = _G.ShowQuestComplete; -local GetQuestLogIndexByID = _G.GetQuestLogIndexByID; -local RemoveAutoQuestPopUp = _G.RemoveAutoQuestPopUp; -local AddAutoQuestPopUp = _G.AddAutoQuestPopUp; -local GetAutoQuestPopUp = _G.GetAutoQuestPopUp; -local GetNumAutoQuestPopUps = _G.GetNumAutoQuestPopUps; --[[ ########################################################## GET ADDON DATA @@ -208,13 +196,13 @@ CORE FUNCTIONS ########################################################## ]]-- -- /script TEST_AUTOPOPUPS() --- function TEST_AUTOPOPUPS() --- local self = MOD.Headers["Popups"]; --- self:SetPopup(0, 'Testing', 'TEST', 1, 1); --- PlaySound("UI_AutoQuestComplete"); --- MOD.Docklet.Parent.Alert:Activate(self,50) --- self:FadeIn(); --- end +function TEST_AUTOPOPUPS() + local self = MOD.Headers["Popups"]; + self:SetPopup(0, 'Testing', 'TEST', 1, 1); + PlaySound("UI_AutoQuestComplete"); + MOD.Docklet.Parent.Alert:Activate(self,50) + self:FadeIn(); +end function MOD:UpdatePopupQuests(event, ...) local questID = ...; diff --git a/SVUI_QuestTracker/components/quests.lua b/SVUI_QuestTracker/components/quests.lua index 6b9ffba..52ca569 100644 --- a/SVUI_QuestTracker/components/quests.lua +++ b/SVUI_QuestTracker/components/quests.lua @@ -1132,6 +1132,7 @@ function MOD:UpdateObjectives(event, ...) end local function ReAnchorItemBar() + if(InCombatLockdown()) then return end local dockletLocation = MOD.Docklet.Parent.Bar.Data.Location; local isHorizontal = (SV.db.QuestTracker.itemBarDirection == 'HORIZONTAL'); local anchor1 = isHorizontal and "LEFT" or "RIGHT"; @@ -1158,10 +1159,8 @@ local function ReAnchorItemBar() anchor2 = prefix2 .. anchor2; local parentWindow = MOD.Docklet.Parent.Window; - ItemBar:ClearAllPoints(); - ItemBar:SetParent(SV.Screen); - ItemBar:SetPoint(anchor1, parentWindow, anchor2, xOff, yOff); + ItemBar:SetSecurePoint(anchor1, parentWindow, anchor2, xOff, yOff); if(isHorizontal) then ItemBar:SetWidth(parentWindow:GetWidth()); ItemBar:SetHeight(32); @@ -1272,6 +1271,6 @@ function MOD:InitializeQuests() WorldMapFrame:HookScript("OnHide", _hook_WorldMapFrameOnHide) ItemBar:Show() - + SV.Events:On("QUEST_LAYOUT_UPDATED", ReAnchorItemBar, true); SV.Events:On("QUEST_UPVALUES_UPDATED", UpdateQuestLocals, true); end diff --git a/SVUI_UnitFrames/frames.lua b/SVUI_UnitFrames/frames.lua index f458f9e..fba5d96 100644 --- a/SVUI_UnitFrames/frames.lua +++ b/SVUI_UnitFrames/frames.lua @@ -259,13 +259,14 @@ local UpdatePlayerFrame = function(self) end do - if db.combatfade and not self:IsElementEnabled("CombatFade")then + self.CombatFade = db.combatfade; + if(self.CombatFade and (not self:IsElementEnabled("CombatFade"))) then self:EnableElement("CombatFade") - elseif - not db.combatfade and self:IsElementEnabled("CombatFade")then + elseif(self:IsElementEnabled("CombatFade") and (not self.CombatFade)) then self:DisableElement("CombatFade") end end + self:UpdateAllElements() end @@ -295,7 +296,7 @@ CONSTRUCTORS["player"] = function(self, unit) self.Afflicted = MOD:CreateAfflicted(self) self.HealPrediction = MOD:CreateHealPrediction(self, true) self.ResolveBar = MOD:CreateResolveBar(self) - self.CombatFade = true; + self.CombatFade = false; self:SetPoint("BOTTOMRIGHT", SV.Screen, "BOTTOM", -80, 182) SV:NewAnchor(self, L["Player Frame"]) SV:SetAnchorResizing(self, unitLayoutPostSizeFunc, 10, 500) diff --git a/SVUI_UnitFrames/libs/Plugins/oUF_CombatFader/oUF_CombatFader.lua b/SVUI_UnitFrames/libs/Plugins/oUF_CombatFader/oUF_CombatFader.lua index c311300..bcfd71d 100644 --- a/SVUI_UnitFrames/libs/Plugins/oUF_CombatFader/oUF_CombatFader.lua +++ b/SVUI_UnitFrames/libs/Plugins/oUF_CombatFader/oUF_CombatFader.lua @@ -89,7 +89,7 @@ local Update = function(self, arg1, arg2) end local Enable = function(self, unit) - if self.CombatFade then + if(self.CombatFade) then frames[self] = self.unit allFrames[self] = self.unit