diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index 8e20658..e947597 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -351,6 +351,9 @@ local barPrototype = { if (self.additionalBarsClip) then startProgress = max(0, min(1, startProgress)); endProgress = max(0, min(1, endProgress)); + else + startProgress = max(-10, min(11, startProgress)); + endProgress = max(-10, min(11, endProgress)); end if ((endProgress - startProgress) == 0) then diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 0634280..1d1af67 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -820,6 +820,7 @@ local function modify(parent, region, data) cloneId = cloneID, dataIndex = dataIndex, controlPoint = controlPoint, + parent = region } if childData.regionType == "text" then diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index a0802ae..f26e8ce 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -4702,6 +4702,9 @@ do local function frame_monitor_callback(event, frame, unit) local new_frame local update_frame = event == "FRAME_UNIT_UPDATE" + + local dynamicGroupsToUpdate = {} + if type(glow_frame_monitor) == "table" then for region, data in pairs(glow_frame_monitor) do if region.state and region.state.unit == unit @@ -4749,16 +4752,14 @@ do new_frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames end if new_frame and new_frame ~= data_frame then - regionData.controlPoint:ReAnchor(new_frame) - if regionData.shown and new_frame ~= WeakAuras.HiddenFrames then - regionData.controlPoint:Show() - else - regionData.controlPoint:Hide() - end - WeakAuras.dyngroup_unitframe_monitor[regionData] = new_frame + dynamicGroupsToUpdate[regionData.parent] = true end end end + + for frame in pairs(dynamicGroupsToUpdate) do + frame:DoPositionChildren() + end end LGF.RegisterCallback("WeakAuras", "FRAME_UNIT_UPDATE", frame_monitor_callback) @@ -6901,7 +6902,18 @@ function WeakAuras.AnchorFrame(data, region, parent) region:SetParent(frame); end - region:SetAnchor(data.selfPoint, anchorParent, data.anchorPoint); + local anchorPoint = data.anchorPoint + if data.parent then + if data.anchorFrameType == "SCREEN" or data.anchorFrameType == "MOUSE" then + anchorPoint = "CENTER" + end + else + if data.anchorFrameType == "MOUSE" then + anchorPoint = "CENTER" + end + end + + region:SetAnchor(data.selfPoint, anchorParent, anchorPoint); if(data.frameStrata == 1) then local frameStrata = region:GetParent():GetFrameStrata() diff --git a/WeakAurasOptions/OptionsFrames/MoverSizer.lua b/WeakAurasOptions/OptionsFrames/MoverSizer.lua index ad48be1..a638f5d 100644 --- a/WeakAurasOptions/OptionsFrames/MoverSizer.lua +++ b/WeakAurasOptions/OptionsFrames/MoverSizer.lua @@ -471,6 +471,7 @@ local function ConstructMoverSizer(parent) if not ok then return end + self:Show() mover.selfPoint, mover.anchor, mover.anchorPoint = selfPoint, anchor, anchorPoint @@ -837,7 +838,12 @@ local function ConstructMoverSizer(parent) local region = self.moving.region local data = self.moving.data if not self.isMoving then - self.selfPoint, self.anchor, self.anchorPoint = region:GetPoint(1) + local ok, selfPoint, anchor, anchorPoint = pcall(region.GetPoint, region, 1) + if not ok then + self:Hide() + return + end + self.selfPoint, self.anchor, self.anchorPoint = selfPoint, anchor, anchorPoint end self.selfPointIcon:ClearAllPoints() self.selfPointIcon:SetPoint("CENTER", region, self.selfPoint) diff --git a/WeakAurasOptions/RegionOptions/Group.lua b/WeakAurasOptions/RegionOptions/Group.lua index 54be449..52e3f22 100644 --- a/WeakAurasOptions/RegionOptions/Group.lua +++ b/WeakAurasOptions/RegionOptions/Group.lua @@ -8,7 +8,7 @@ local function getRect(data) local blx, bly, trx, try; blx, bly = data.xOffset or 0, data.yOffset or 0; - if (data.width == nil or data.height == nil) then + if (data.width == nil or data.height == nil or data.regionType == "text") then return blx, bly, blx, bly; end @@ -36,6 +36,23 @@ local function getRect(data) return blx, bly, trx, try; end +local function getHeight(data, region) + if data.regionType == "text" then + return region.height + else + return data.height + end +end + + +local function getWidth(data, region) + if data.regionType == "text" then + return region.width + else + return data.width + end +end + -- Create region options table local function createOptions(id, data) -- Region options @@ -100,9 +117,9 @@ local function createOptions(id, data) if(childData and childRegion) then if(v == "CENTER") then if(childData.selfPoint:find("LEFT")) then - childData.xOffset = 0 - ((childData.width or childRegion.width) / 2); + childData.xOffset = 0 - (getWidth(childData, childRegion) / 2); elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = 0 + ((childData.width or childRegion.width) / 2); + childData.xOffset = 0 + (getWidth(childData, childRegion) / 2); else childData.xOffset = 0; end @@ -110,17 +127,17 @@ local function createOptions(id, data) if(childData.selfPoint:find("LEFT")) then childData.xOffset = 0; elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = 0 + (childData.width or childRegion.width); + childData.xOffset = 0 + getWidth(childData, childRegion); else - childData.xOffset = 0 + ((childData.width or childRegion.width) / 2); + childData.xOffset = 0 + (getWidth(childData, childRegion) / 2); end elseif(v == "RIGHT") then if(childData.selfPoint:find("LEFT")) then - childData.xOffset = 0 - (childData.width or childRegion.width); + childData.xOffset = 0 - getWidth(childData, childRegion); elseif(childData.selfPoint:find("RIGHT")) then childData.xOffset = 0; else - childData.xOffset = 0 - ((childData.width or childRegion.width) / 2); + childData.xOffset = 0 - (getWidth(childData, childRegion) / 2); end end WeakAuras.Add(childData); @@ -166,9 +183,9 @@ local function createOptions(id, data) if(childData and childRegion) then if(v == "CENTER") then if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = 0 - ((childData.height or childRegion.height) / 2); + childData.yOffset = 0 - (getHeight(childData, childRegion) / 2); elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = 0 + ((childData.height or childRegion.height) / 2); + childData.yOffset = 0 + (getHeight(childData, childRegion) / 2); else childData.yOffset = 0; end @@ -176,17 +193,17 @@ local function createOptions(id, data) if(childData.selfPoint:find("BOTTOM")) then childData.yOffset = 0; elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = 0 + (childData.height or childRegion.height); + childData.yOffset = 0 + getHeight(childData, childRegion); else - childData.yOffset = 0 + ((childData.height or childRegion.height) / 2); + childData.yOffset = 0 + (getHeight(childData, childRegion) / 2); end elseif(v == "LEFT") then if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = 0 - ( childData.height or childRegion.height); + childData.yOffset = 0 - getHeight(childData, childRegion); elseif(childData.selfPoint:find("TOP")) then childData.yOffset = 0; else - childData.yOffset = 0 - ((childData.height or childRegion.height) / 2); + childData.yOffset = 0 - (getHeight(childData, childRegion) / 2); end end WeakAuras.Add(childData); @@ -256,18 +273,18 @@ local function createOptions(id, data) if(childData.selfPoint:find("LEFT")) then childData.xOffset = xOffset; elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset + (childData.width or childRegion.width); + childData.xOffset = xOffset + getWidth(childData, childRegion); else - childData.xOffset = xOffset + ((childData.width or childRegion.width) / 2); + childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2); end xOffset = xOffset + v; elseif(v < 0) then if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset - (childData.width or childRegion.width); + childData.xOffset = xOffset - getWidth(childData, childRegion); elseif(childData.selfPoint:find("RIGHT")) then childData.xOffset = xOffset; else - childData.xOffset = xOffset - ((childData.width or childRegion.width) / 2); + childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2); end xOffset = xOffset + v; end @@ -339,18 +356,18 @@ local function createOptions(id, data) if(childData.selfPoint:find("BOTTOM")) then childData.yOffset = yOffset; elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset + (childData.height or childRegion.height); + childData.yOffset = yOffset + getHeight(childData, childRegion); else - childData.yOffset = yOffset + ((childData.height or childRegion.height) / 2); + childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2); end yOffset = yOffset + v; elseif(v < 0) then if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset - (childData.height or childRegion.height); + childData.yOffset = yOffset - getHeight(childData, childRegion); elseif(childData.selfPoint:find("TOP")) then childData.yOffset = yOffset; else - childData.yOffset = yOffset - ((childData.height or childRegion.height) / 2); + childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2); end yOffset = yOffset + v; end @@ -422,20 +439,20 @@ local function createOptions(id, data) if(childData.selfPoint:find("LEFT")) then childData.xOffset = xOffset; elseif(childData.selfPoint:find("RIGHT")) then - childData.xOffset = xOffset + (childData.width or childRegion.width); + childData.xOffset = xOffset + getWidth(childData, childRegion); else - childData.xOffset = xOffset + ((childData.width or childRegion.width) / 2); + childData.xOffset = xOffset + (getWidth(childData, childRegion) / 2); end - xOffset = xOffset + v + (childData.width or childRegion.width); + xOffset = xOffset + v + getWidth(childData, childRegion); elseif(v < 0) then if(childData.selfPoint:find("LEFT")) then - childData.xOffset = xOffset - (childData.width or childRegion.width); + childData.xOffset = xOffset - getWidth(childData, childRegion); elseif(childData.selfPoint:find("RIGHT")) then childData.xOffset = xOffset; else - childData.xOffset = xOffset - ((childData.width or childRegion.width) / 2); + childData.xOffset = xOffset - (getWidth(childData, childRegion) / 2); end - xOffset = xOffset + v - (childData.width or childRegion.width); + xOffset = xOffset + v - getWidth(childData, childRegion); end WeakAuras.Add(childData); end @@ -505,20 +522,20 @@ local function createOptions(id, data) if(childData.selfPoint:find("BOTTOM")) then childData.yOffset = yOffset; elseif(childData.selfPoint:find("TOP")) then - childData.yOffset = yOffset + (childData.height or childRegion.height); + childData.yOffset = yOffset + getHeight(childData, childRegion); else - childData.yOffset = yOffset + ((childData.height or childRegion.height) / 2); + childData.yOffset = yOffset + (getHeight(childData, childRegion) / 2); end - yOffset = yOffset + v + (childData.height or childRegion.height); + yOffset = yOffset + v + getHeight(childData, childRegion); elseif(v < 0) then if(childData.selfPoint:find("BOTTOM")) then - childData.yOffset = yOffset - (childData.height or childRegion.height); + childData.yOffset = yOffset - getHeight(childData, childRegion); elseif(childData.selfPoint:find("TOP")) then childData.yOffset = yOffset; else - childData.yOffset = yOffset - ((childData.height or childRegion.height) / 2); + childData.yOffset = yOffset - (getHeight(childData, childRegion) / 2); end - yOffset = yOffset + v - (childData.height or childRegion.height); + yOffset = yOffset + v - getHeight(childData, childRegion); end WeakAuras.Add(childData); end