from retail
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
|
||||
local AddonName, Private = ...
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
local default = {
|
||||
width = 200,
|
||||
height = 200,
|
||||
selfPoint = "CENTER",
|
||||
anchorPoint = "CENTER",
|
||||
anchorFrameType = "SCREEN",
|
||||
xOffset = 0,
|
||||
yOffset = 0,
|
||||
frameStrata = 1
|
||||
}
|
||||
|
||||
Private.regionPrototype.AddAlphaToDefault(default)
|
||||
|
||||
local properties = {
|
||||
}
|
||||
|
||||
|
||||
Private.regionPrototype.AddProperties(properties, default);
|
||||
|
||||
local function create(parent)
|
||||
local region = CreateFrame("Frame", nil, UIParent)
|
||||
region.regionType = "empty"
|
||||
region:SetMovable(true)
|
||||
region:SetResizable(true)
|
||||
region:SetMinResize(1, 1)
|
||||
|
||||
region.Update = function() end
|
||||
|
||||
Private.regionPrototype.create(region)
|
||||
return region
|
||||
end
|
||||
|
||||
local function modify(parent, region, data)
|
||||
Private.regionPrototype.modify(parent, region, data)
|
||||
region:SetWidth(data.width)
|
||||
region:SetHeight(data.height)
|
||||
region.width = data.width
|
||||
region.height = data.height
|
||||
region.scalex = 1
|
||||
region.scaley = 1
|
||||
Private.regionPrototype.modifyFinish(parent, region, data)
|
||||
end
|
||||
|
||||
Private.RegisterRegionType("empty", create, modify, default, properties)
|
||||
@@ -713,20 +713,7 @@ function Private.regionPrototype.create(region)
|
||||
region:SetPoint("CENTER", UIParent, "CENTER")
|
||||
end
|
||||
|
||||
function Private.regionPrototype.modify(parent, region, data)
|
||||
region.state = nil
|
||||
region.states = nil
|
||||
region.subRegionEvents:ClearSubscribers()
|
||||
region.subRegionEvents:ClearCallbacks()
|
||||
Private.FrameTick:RemoveSubscriber("Tick", region)
|
||||
|
||||
local defaultsForRegion = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default;
|
||||
|
||||
if region.SetRegionAlpha then
|
||||
region:SetRegionAlpha(data.alpha)
|
||||
end
|
||||
|
||||
local hasProgressSource = defaultsForRegion and defaultsForRegion.progressSource
|
||||
function Private.regionPrototype.AddMinMaxProgressSource(hasProgressSource, region, parentData, data)
|
||||
local hasAdjustedMin = hasProgressSource and data.useAdjustededMin and data.adjustedMin
|
||||
local hasAdjustedMax = hasProgressSource and data.useAdjustededMax and data.adjustedMax
|
||||
|
||||
@@ -737,7 +724,7 @@ function Private.regionPrototype.modify(parent, region, data)
|
||||
region.adjustedMaxRelPercent = nil
|
||||
|
||||
if hasProgressSource then
|
||||
region.progressSource = Private.AddProgressSourceMetaData(data, data.progressSource)
|
||||
region.progressSource = Private.AddProgressSourceMetaData(parentData, data.progressSource)
|
||||
end
|
||||
|
||||
if (hasAdjustedMin) then
|
||||
@@ -756,6 +743,19 @@ function Private.regionPrototype.modify(parent, region, data)
|
||||
region.adjustedMax = tonumber(data.adjustedMax)
|
||||
end
|
||||
end
|
||||
end
|
||||
function Private.regionPrototype.modify(parent, region, data)
|
||||
region.state = nil
|
||||
region.states = nil
|
||||
region.subRegionEvents:ClearSubscribers()
|
||||
region.subRegionEvents:ClearCallbacks()
|
||||
Private.FrameTick:RemoveSubscriber("Tick", region)
|
||||
local defaultsForRegion = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default;
|
||||
if region.SetRegionAlpha then
|
||||
region:SetRegionAlpha(data.alpha)
|
||||
end
|
||||
local hasProgressSource = defaultsForRegion and defaultsForRegion.progressSource
|
||||
Private.regionPrototype.AddMinMaxProgressSource(hasProgressSource, region, data, data)
|
||||
|
||||
region:SetOffset(data.xOffset or 0, data.yOffset or 0);
|
||||
region:SetOffsetRelative(0, 0)
|
||||
|
||||
@@ -150,6 +150,10 @@ local function modify(parent, region, data)
|
||||
self:UpdateProgress()
|
||||
end
|
||||
|
||||
function region:SetTexture(texture)
|
||||
self.texture:SetTexture(texture)
|
||||
end
|
||||
|
||||
region.texture:SetTexture(data.texture)
|
||||
|
||||
function region:Color(r, g, b, a)
|
||||
|
||||
Reference in New Issue
Block a user