from retail

This commit is contained in:
Bunny67
2020-09-16 12:21:03 +03:00
parent 9d8f4960b7
commit 2c393172f8
5 changed files with 81 additions and 42 deletions
+50 -33
View File
@@ -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