from retail
This commit is contained in:
@@ -99,22 +99,28 @@ local function modify(parent, region, data)
|
||||
-- Scale
|
||||
region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
|
||||
|
||||
-- Get overall bounding box
|
||||
local leftest, rightest, lowest, highest = 0, 0, 0, 0;
|
||||
for child in Private.TraverseLeafs(data) do
|
||||
local childRegion = WeakAuras.GetRegion(child.id)
|
||||
if(child) then
|
||||
local blx, bly, trx, try = getRect(child, childRegion);
|
||||
leftest = math.min(leftest, blx);
|
||||
rightest = math.max(rightest, trx);
|
||||
lowest = math.min(lowest, bly);
|
||||
highest = math.max(highest, try);
|
||||
region.GetBoundingRect = function(self)
|
||||
if not self.boundingRect then
|
||||
local leftest, rightest, lowest, highest = 0, 0, 0, 0;
|
||||
for child in Private.TraverseLeafs(data) do
|
||||
local childRegion = WeakAuras.GetRegion(child.id)
|
||||
if(child) then
|
||||
local blx, bly, trx, try = getRect(child, childRegion);
|
||||
leftest = math.min(leftest, blx);
|
||||
rightest = math.max(rightest, trx);
|
||||
lowest = math.min(lowest, bly);
|
||||
highest = math.max(highest, try);
|
||||
end
|
||||
end
|
||||
self.blx = leftest
|
||||
self.bly = lowest
|
||||
self.trx = rightest
|
||||
self.try = highest
|
||||
self.boundingRect = true
|
||||
end
|
||||
return self.blx, self.bly, self.trx, self.try
|
||||
end
|
||||
region.blx = leftest;
|
||||
region.bly = lowest;
|
||||
region.trx = rightest;
|
||||
region.try = highest;
|
||||
region.boundingRect = false
|
||||
|
||||
-- Adjust frame-level sorting
|
||||
Private.FixGroupChildrenOrderForGroup(data);
|
||||
@@ -150,6 +156,8 @@ local function modify(parent, region, data)
|
||||
|
||||
-- Show border if child is visible
|
||||
if childVisible then
|
||||
local blx, bly, trx, try = self:GetBoundingRect()
|
||||
|
||||
border:SetBackdrop({
|
||||
edgeFile = data.borderEdge ~= "None" and SharedMedia:Fetch("border", data.borderEdge) or "",
|
||||
edgeSize = data.borderSize,
|
||||
@@ -165,8 +173,8 @@ local function modify(parent, region, data)
|
||||
border:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]);
|
||||
|
||||
border:ClearAllPoints();
|
||||
border:SetPoint("bottomleft", region, "bottomleft", leftest-data.borderOffset, lowest-data.borderOffset);
|
||||
border:SetPoint("topright", region, "topright", rightest+data.borderOffset, highest+data.borderOffset);
|
||||
border:SetPoint("bottomleft", region, "bottomleft", blx - data.borderOffset, bly - data.borderOffset);
|
||||
border:SetPoint("topright", region, "topright", trx + data.borderOffset, try + data.borderOffset);
|
||||
border:Show();
|
||||
else
|
||||
border:Hide();
|
||||
|
||||
@@ -33,6 +33,8 @@ local default = {
|
||||
borderBackdrop = "Blizzard Tooltip"
|
||||
};
|
||||
|
||||
Private.regionPrototype.AddAlphaToDefault(default)
|
||||
|
||||
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
|
||||
|
||||
local properties = {
|
||||
@@ -63,7 +65,13 @@ local function GetProperties(data)
|
||||
end
|
||||
|
||||
local regionFunctions = {
|
||||
Update = function() end
|
||||
Update = function() end,
|
||||
SetAlpha = function(self, alpha)
|
||||
self.alpha = alpha
|
||||
if self.model then
|
||||
self.model:SetAlpha(alpha)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Called when first creating a new region/display
|
||||
@@ -161,6 +169,7 @@ local function AcquireModel(region, data)
|
||||
end
|
||||
|
||||
local function ReleaseModel(model)
|
||||
model:SetAlpha(1)
|
||||
--model:SetKeepModelOnHide(false)
|
||||
model:Hide()
|
||||
model:UnregisterEvent("UNIT_MODEL_CHANGED");
|
||||
@@ -272,6 +281,9 @@ local function modify(parent, region, data)
|
||||
else
|
||||
ConfigureModel(region, region.model, data)
|
||||
end
|
||||
if type(data.alpha) == "number" then
|
||||
region:SetAlpha(data.alpha)
|
||||
end
|
||||
end
|
||||
|
||||
function region:PreHide()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local AddonName, Private = ...
|
||||
|
||||
local internalVersion = 82
|
||||
local internalVersion = 83
|
||||
|
||||
-- Lua APIs
|
||||
local insert = table.insert
|
||||
@@ -2935,8 +2935,9 @@ function Private.SetRegion(data, cloneId)
|
||||
|
||||
local parent = WeakAurasFrame;
|
||||
if(data.parent) then
|
||||
if WeakAuras.GetData(data.parent) then
|
||||
parent = Private.EnsureRegion(data.parent)
|
||||
local parentRegion = WeakAuras.GetRegion(data.parent)
|
||||
if parentRegion then
|
||||
parent = parentRegion
|
||||
else
|
||||
data.parent = nil;
|
||||
end
|
||||
@@ -2998,6 +2999,10 @@ local function EnsureRegion(id)
|
||||
local data = WeakAuras.GetData(id)
|
||||
tinsert(aurasToCreate, data.id)
|
||||
id = data.parent
|
||||
|
||||
if WeakAuras.GetRegion(id) then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
for _, toCreateId in ipairs_reverse(aurasToCreate) do
|
||||
|
||||
@@ -648,7 +648,15 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
|
||||
local icon = spellCache.GetIcon(value);
|
||||
return icon and tostring(icon) or "", 18, 18;
|
||||
elseif(arg.type == "spell") then
|
||||
local _, _, icon = GetSpellInfo(value);
|
||||
local spellName, _, icon = GetSpellInfo(value);
|
||||
if arg.noValidation then
|
||||
-- GetSpellInfo and other wow apis are case insensitive, but the later matching we do
|
||||
-- isn't. For validted inputs, we automatically correct the casing via GetSpellName
|
||||
-- Since we don't do that for noValidation, we are extra picky on the input
|
||||
if type(value) == "string" and spellName ~= value then
|
||||
return "", 18, 18
|
||||
end
|
||||
end
|
||||
return icon and tostring(icon) or "", 18, 18;
|
||||
elseif(arg.type == "item") then
|
||||
local _, _, _, _, _, _, _, _, _, icon = GetItemInfo(value);
|
||||
|
||||
@@ -516,8 +516,9 @@ local function ConstructMoverSizer(parent)
|
||||
mover:ClearAllPoints()
|
||||
frame:ClearAllPoints()
|
||||
if data.regionType == "group" then
|
||||
mover:SetWidth((region.trx - region.blx) * scale)
|
||||
mover:SetHeight((region.try - region.bly) * scale)
|
||||
local blx, bly, trx, try = region:GetBoundingRect()
|
||||
mover:SetWidth((trx - blx) * scale)
|
||||
mover:SetHeight((try - bly) * scale)
|
||||
mover:SetPoint("BOTTOMLEFT", mover.anchor or UIParent, mover.anchorPoint or "CENTER", (xOff + region.blx) * scale, (yOff + region.bly) * scale)
|
||||
else
|
||||
mover:SetWidth(region:GetWidth() * scale)
|
||||
|
||||
@@ -103,6 +103,17 @@ local function createOptions(id, data)
|
||||
bigStep = 3,
|
||||
order = 45,
|
||||
},
|
||||
alpha = {
|
||||
type = "range",
|
||||
control = "WeakAurasSpinBox",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Alpha"],
|
||||
order = 50,
|
||||
min = 0,
|
||||
max = 1,
|
||||
bigStep = 0.01,
|
||||
isPercent = true
|
||||
},
|
||||
endHeader = {
|
||||
type = "header",
|
||||
order = 100,
|
||||
|
||||
Reference in New Issue
Block a user