Refactor progress handling

probably some regressions
This commit is contained in:
NoM0Re
2025-01-22 03:37:10 +01:00
parent a643b275ba
commit 23c7da5ea6
29 changed files with 2037 additions and 1263 deletions
@@ -990,9 +990,6 @@ local methods = {
else
OptionsPrivate.Private.GetTriggerDescription(data, -1, namestable)
end
if(OptionsPrivate.Private.CanHaveClones(data)) then
tinsert(namestable, {" ", "|cFF00FF00"..L["Auto-cloning enabled"]})
end
local hasDescription = data.desc and data.desc ~= "";
local hasUrl = data.url and data.url ~= "";
@@ -39,16 +39,18 @@ local methods = {
if mode == "one" then
self.firstDropdown.frame:Show()
self.secondDropDown.frame:Hide()
self.firstDropdown.frame:SetAllPoints(self.frame)
self.firstDropdown.frame:ClearAllPoints()
self.firstDropdown.frame:SetPoint("TOPLEFT", self.frame)
self.firstDropdown.frame:SetPoint("TOPRIGHT", self.frame)
else
local halfWidth = self.frame:GetWidth() / 2
self.firstDropdown.frame:Show()
self.secondDropDown.frame:Show()
self.firstDropdown.frame:ClearAllPoints()
self.firstDropdown.frame:SetPoint("TOPLEFT", self.frame)
self.firstDropdown.frame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMLEFT", halfWidth, 0)
self.firstDropdown.frame:SetPoint("TOPRIGHT", self.frame, "TOPLEFT", halfWidth, 0)
self.secondDropDown.frame:SetPoint("TOPLEFT", self.frame, halfWidth, 0)
self.secondDropDown.frame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT")
self.secondDropDown.frame:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT")
end
end,
["OnAcquire"] = function(widget)
@@ -154,8 +156,11 @@ local methods = {
self.firstDropdown = nil
self.secondDropDown = nil
end,
["SetLabel"] = function(self, ...)
self.firstDropdown:SetLabel(...)
["SetLabel"] = function(self, v)
if v == "" then
v = " "
end
self.firstDropdown:SetLabel(v)
end,
["SetValue"] = function(self, value)
for displayName, treeValue in pairs(self.userdata.tree) do
+2 -26
View File
@@ -143,18 +143,6 @@ function OptionsPrivate.GetAnimationOptions(data)
values = function() return filterAnimPresetTypes(anim_start_preset_types, id) end,
hidden = function() return data.animation.start.type ~= "preset" end
},
start_duration_type_no_choice = {
type = "select",
width = WeakAuras.halfWidth,
name = L["Time in"],
order = 33,
values = duration_types_no_choice,
disabled = true,
hidden = function()
return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data)
end,
get = function() return "seconds" end
},
start_duration_type = {
type = "select",
width = WeakAuras.halfWidth,
@@ -162,7 +150,7 @@ function OptionsPrivate.GetAnimationOptions(data)
order = 33,
values = duration_types,
hidden = function()
return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data)
return data.animation.start.type ~= "custom"
end
},
start_duration = {
@@ -418,18 +406,6 @@ function OptionsPrivate.GetAnimationOptions(data)
values = function() return filterAnimPresetTypes(anim_main_preset_types, id) end,
hidden = function() return data.animation.main.type ~= "preset" end
},
main_duration_type_no_choice = {
type = "select",
width = WeakAuras.halfWidth,
name = L["Time in"],
order = 53,
values = duration_types_no_choice,
disabled = true,
hidden = function()
return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data)
end,
get = function() return "seconds" end
},
main_duration_type = {
type = "select",
width = WeakAuras.halfWidth,
@@ -437,7 +413,7 @@ function OptionsPrivate.GetAnimationOptions(data)
order = 53,
values = duration_types,
hidden = function()
return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data)
return data.animation.main.type ~= "custom"
end
},
main_duration = {
+148
View File
@@ -1038,6 +1038,153 @@ local function CreateExecuteAll(subOption)
end
end
local function ProgressOptions(data)
local order = 1
local options = {
__title = L["Progress Settings"],
__order = 98,
}
options.progressSource = {
type = "select",
width = WeakAuras.doubleWidth,
name = L["Progress Source"],
order = order,
control = "WeakAurasTwoColumnDropdown",
values = OptionsPrivate.Private.GetProgressSourcesForUi(data),
get = function(info)
return OptionsPrivate.Private.GetProgressValueConstant(data.progressSource)
end,
set = function(info, value)
if value then
data.progressSource = data.progressSource or {}
-- Copy only trigger + property
data.progressSource[1] = value[1]
data.progressSource[2] = value[2]
else
data.progressSource = nil
end
WeakAuras.Add(data)
end
}
options.progressSourceWarning = {
type = "description",
width = WeakAuras.doubleWidth,
name = L["Note: This progress source does not provide a total value/duration. A total value/duration must be set via \"Set Maximum Progress\""],
order = order + 0.5,
hidden = function()
local progressSource = OptionsPrivate.Private.AddProgressSourceMetaData(data, data.progressSource)
-- Auto progress, Manual Progress or the progress source has a total property
if not progressSource or progressSource[2] == "auto" or progressSource[1] == 0 or progressSource[4] ~= nil then
return true
end
return false
end
}
local function hiddenManual()
if data.progressSource and data.progressSource[1] == 0 then
return false
end
return true
end
options.progressSourceManualValue = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Value"],
order = order + 0.7,
min = 0,
softMax = 100,
bigStep = 1,
hidden = hiddenManual,
get = function(info)
return data.progressSource and data.progressSource[3] or 0
end,
set = function(info, value)
data.progressSource = data.progressSource or {}
data.progressSource[3] = value
WeakAuras.Add(data)
end
}
options.progressSourceManualTotal = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Total"],
order = order + 0.8,
min = 0,
softMax = 100,
bigStep = 1,
hidden = hiddenManual,
get = function(info)
return data.progressSource and data.progressSource[4] or 100
end,
set = function(info, value)
data.progressSource = data.progressSource or {}
data.progressSource[4] = value
WeakAuras.Add(data)
end
}
options.useAdjustededMin = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Set Minimum Progress"],
desc = L["Values/Remaining Time below this value are displayed as zero progress."],
order = order + 1
};
options.adjustedMin = {
type = "input",
validate = WeakAuras.ValidateNumericOrPercent,
width = WeakAuras.normalWidth,
order = order + 2,
name = L["Minimum"],
hidden = function() return not data.useAdjustededMin end,
desc = L["Enter static or relative values with %"]
};
options.useAdjustedMinSpacer = {
type = "description",
width = WeakAuras.normalWidth,
name = "",
order = order + 3,
hidden = function() return not (not data.useAdjustededMin and data.useAdjustededMax) end,
}
options.useAdjustededMax = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Set Maximum Progress"],
desc = L["Values/Remaining Time above this value are displayed as full progress."],
order = order + 4
}
options.adjustedMax = {
type = "input",
width = WeakAuras.normalWidth,
validate = WeakAuras.ValidateNumericOrPercent,
order = order + 5,
name = L["Maximum"],
hidden = function() return not data.useAdjustededMax end,
desc = L["Enter static or relative values with %"]
}
options.useAdjustedMaxSpacer = {
type = "description",
width = WeakAuras.normalWidth,
name = "",
order = order + 6,
hidden = function() return not (data.useAdjustededMin and not data.useAdjustededMax) end,
}
return options
end
local function PositionOptions(id, data, _, hideWidthHeight, disableSelfPoint, group)
local metaOrder = 99
local function IsParentDynamicGroup()
@@ -1617,6 +1764,7 @@ OptionsPrivate.commonOptions.CreateSetAll = CreateSetAll
OptionsPrivate.commonOptions.CreateExecuteAll = CreateExecuteAll
OptionsPrivate.commonOptions.PositionOptions = PositionOptions
OptionsPrivate.commonOptions.ProgressOptions = ProgressOptions
OptionsPrivate.commonOptions.BorderOptions = BorderOptions
OptionsPrivate.commonOptions.AddCodeOption = AddCodeOption
+129 -10
View File
@@ -71,6 +71,17 @@ local function compareValues(a, b, propertytype)
and a[2] == b[2]
and a[3] == b[3]
and a[4] == b[4];
elseif propertytype == "progressSource" then
if type(a) == "table" and type(b) == "table" then
local triggerA, propertyA, triggerB, propertyB = a[1], a[2], b[1], b[2]
if triggerA ~= triggerB or propertyA ~= propertyB then
return false
end
if triggerA == 0 then
return a[3] == b[3] and a[4] == b[4]
end
return true
end
end
return a == b;
end
@@ -139,15 +150,36 @@ local function descIfSubset(data, reference, totalAuraCount)
return "";
end
local function descIfNoValue(data, object, variable, type, values)
local function descIfNoValue(data, object, variable, propertyType, values)
if (data.controlledChildren) then
if (object["same" .. variable] == false) then
local desc = "";
for id, reference in pairs(object.references) do
if (type == "list" and values) then
if propertyType == "list" and values then
desc = desc .."|cFFE0E000".. id .. ": |r" .. (values[reference[variable]] or "") .. "\n";
elseif propertyType == "progressSource" then
desc = desc .."|cFFE0E000".. id .. ": |r"
local progressSource = reference[variable]
if type(progressSource) == "table" then
local trigger = progressSource[1]
if trigger == 0 then
desc = desc .. L["Manual with %i/%i"]:format(progressSource[3] or 0, progressSource[4] or 100)
else
local p = OptionsPrivate.Private.GetProgressValueConstant(progressSource)
local description = values[p] or ""
if type(description) == "string" then
desc = desc .. description
elseif type(description) == "table"
and type(description[1]) == "string"
and type(description[2]) == "string"
then
desc = desc .. description[1] .. " " .. description[2]
end
end
end
desc = desc .."\n"
else
desc = desc .."|cFFE0E000".. id .. ": |r" .. (valueToString(reference[variable], type) or "") .. "\n";
desc = desc .."|cFFE0E000".. id .. ": |r" .. (valueToString(reference[variable], propertyType) or "") .. "\n";
end
end
return desc;
@@ -298,6 +330,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
order = order + 1;
local setValue;
local setValueTable
local setValueColor;
local setValueComplex;
local setValueColorComplex;
@@ -313,6 +346,17 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
conditions[i].changes[j].value = v;
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueTable = function(info, v)
for id, reference in pairs(conditions[i].changes[j].references) do
local auraData = WeakAuras.GetData(id)
local conditionIndex = conditions[i].check.references[id].conditionIndex
auraData[conditionVariable][conditionIndex].changes[reference.changeIndex].value = CopyTable(v)
WeakAuras.Add(auraData)
OptionsPrivate.ClearOptions(auraData.id)
end
conditions[i].changes[j].value = CopyTable(v)
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueColor = function(info, r, g, b, a)
for id, reference in pairs(conditions[i].changes[j].references) do
local auraData = WeakAuras.GetData(id);
@@ -332,7 +376,11 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
conditions[i].changes[j].value[4] = a;
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueTable = function(info, v)
conditions[i].changes[j].value = CopyTable(v)
WeakAuras.Add(data)
WeakAuras.ClearAndUpdateOptions(data.id)
end
setValueComplex = function(property)
return function(info, v)
for id, reference in pairs(conditions[i].changes[j].references) do
@@ -531,21 +579,92 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
set = setValueColor
}
order = order + 1;
elseif (propertyType == "list") then
elseif (propertyType == "list" or property == "progressSource") then
local values = property and allProperties.propertyMap[property] and allProperties.propertyMap[property].values;
args["condition" .. i .. "value" .. j] = {
type = "select",
width = WeakAuras.normalWidth,
values = values,
name = blueIfNoValue(data, conditions[i].changes[j], "value", L["Differences"]),
desc = descIfNoValue(data, conditions[i].changes[j], "value", propertyType, values),
name = blueIfNoValue(data, conditions[i].changes[j], "value", L["Differences"], ""),
desc = descIfNoValue(data, conditions[i].changes[j], "value", propertyType, values),
order = order,
get = function()
return conditions[i].changes[j].value;
end,
set = setValue
set = setValue,
}
order = order + 1;
order = order + 1
if propertyType == "progressSource" then
args["condition" .. i .. "value" .. j].control = "WeakAurasTwoColumnDropdown"
args["condition" .. i .. "value" .. j].set = setValueTable
args["condition" .. i .. "value" .. j].get = function()
local v = conditions[i].changes[j].value
return OptionsPrivate.Private.GetProgressValueConstant(v)
end
args["condition" .. i .. "progressSourceWarning" .. j] = {
type = "description",
width = WeakAuras.doubleWidth,
name = L["Note: This progress source does not provide a total value/duration. A total value/duration must be set via \"Set Maximum Progress\""],
order = order,
hidden = function()
local v = conditions[i].changes[j].value
local progressSource = OptionsPrivate.Private.AddProgressSourceMetaData(data, v)
-- Auto progress, Manual Progress or the progress source has a total property
if progressSource[2] == "auto" or progressSource[1] == 0 or progressSource[4] ~= nil then
return true
end
return false
end
}
order = order + 1
local function hiddenManual()
local v = conditions[i].changes[j].value
local progressSource = OptionsPrivate.Private.AddProgressSourceMetaData(data, v)
if progressSource[1] == 0 then
return false
end
return true
end
args["condition" .. i .. "progressSoruceManualValue" .. j] = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Value"],
order = order,
min = 0,
softMax = 100,
bigStep = 1,
hidden = hiddenManual,
get = function()
local v = conditions[i].changes[j].value
return v and type(v[3]) == "number" and v[3] or 0
end,
set = setValueComplex(3)
}
order = order + 1
args["condition" .. i .. "progressSoruceManualTotal" .. j] = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Total"],
order = order,
min = 0,
softMax = 100,
bigStep = 1,
hidden = hiddenManual,
get = function()
local v = conditions[i].changes[j].value
return v and type(v[4]) == "number" and v[4] or 100
end,
set = setValueComplex(4)
}
order = order + 1
end
elseif (propertyType == "sound") then
args["condition" .. i .. "value" .. j .. "sound_type"] = {
type = "select",
@@ -2455,7 +2574,7 @@ local function buildAllPotentialProperties(data, category)
allProperties.propertyMap[k].type = "incompatible";
end
if (allProperties.propertyMap[k].type == "list") then
if (allProperties.propertyMap[k].type == "list" or allProperties.propertyMap[k].type == "progressSource" ) then
-- Merge value lists
for key, value in pairs(v.values) do
if (allProperties.propertyMap[k].values[key] == nil) then
+4
View File
@@ -317,6 +317,10 @@ local function GetCustomTriggerOptions(data, triggernum)
test = "function",
events = "table",
values = "table",
total = "string",
inverse = "string",
paused = "string",
remaining = "string",
}
local function validateCustomVariables(variables)
+5 -6
View File
@@ -91,21 +91,21 @@ local function createOptions(id, data)
width = WeakAuras.normalWidth,
name = L["Bar Color"],
hasAlpha = true,
order = 39.1
order = 39.3
},
backgroundColor = {
type = "color",
width = WeakAuras.normalWidth,
name = L["Background Color"],
hasAlpha = true,
order = 39.2
order = 39.5
},
alpha = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Bar Alpha"],
order = 39.3,
order = 39.6,
min = 0,
max = 1,
bigStep = 0.01,
@@ -157,7 +157,7 @@ local function createOptions(id, data)
displayIcon = {
type = "input",
width = WeakAuras.normalWidth - 0.15,
name = L["Fallback"],
name = L["Manual"],
disabled = function() return not data.icon end,
order = 40.5,
get = function()
@@ -385,8 +385,6 @@ local function createOptions(id, data)
},
};
options = OptionsPrivate.Private.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
options["overlayheader"] = {
@@ -450,6 +448,7 @@ local function createOptions(id, data)
return {
aurabar = options,
progressOptions = OptionsPrivate.commonOptions.ProgressOptions(data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
+4 -6
View File
@@ -36,7 +36,7 @@ local function createOptions(id, data)
displayIcon = {
type = "input",
width = WeakAuras.normalWidth - 0.15,
name = L["Fallback Icon"],
name = L["Manual Icon"],
order = 4,
get = function()
return data.displayIcon and tostring(data.displayIcon) or "";
@@ -230,8 +230,7 @@ local function createOptions(id, data)
name = L["Enable Swipe"],
order = 11.1,
desc = L["Enable the \"Swipe\" radial overlay"],
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data); end,
get = function() return OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end
get = function() return data.cooldown; end
},
inverse = {
type = "toggle",
@@ -239,8 +238,7 @@ local function createOptions(id, data)
name = L["Inverse"],
order = 11.2,
desc = L["Invert the direction of progress"],
disabled = function() return not (OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown); end,
get = function() return data.inverse and OptionsPrivate.Private.CanHaveDuration(data) and data.cooldown; end,
get = function() return data.inverse and data.cooldown; end,
hidden = function() return not data.cooldown end
},
cooldownEdge = {
@@ -249,7 +247,6 @@ local function createOptions(id, data)
name = L["Show \"Edge\""],
order = 11.4,
desc = "|TInterface\\AddOns\\WeakAuras\\Media\\Textures\\edge-example:30|t\n"..L["Enable \"Edge\" part of the overlay"],
disabled = function() return not OptionsPrivate.Private.CanHaveDuration(data) end,
hidden = function() return not data.cooldown end,
},
endHeader = {
@@ -276,6 +273,7 @@ local function createOptions(id, data)
return {
icon = options,
progressOptions = OptionsPrivate.commonOptions.ProgressOptions(data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
@@ -277,18 +277,12 @@ local function createOptions(id, data)
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end,
values = OptionsPrivate.Private.slant_mode
},
spacer = {
type = "header",
name = "",
order = 56
},
endHeader = {
type = "header",
order = 100,
name = "",
},
};
options = OptionsPrivate.Private.regionPrototype.AddAdjustedDurationOptions(options, data, 57);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
@@ -332,6 +326,7 @@ local function createOptions(id, data)
return {
progresstexture = options,
progressOptions = OptionsPrivate.commonOptions.ProgressOptions(data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data),
};
end
+7 -13
View File
@@ -288,7 +288,7 @@ local function createOptions(id, data)
name = L["Animation Start"],
min = 0,
max = 1,
--bigStep = 0.01,
bigStep = 0.01,
order = 13,
isPercent = true
},
@@ -299,7 +299,7 @@ local function createOptions(id, data)
name = L["Animation End"],
min = 0,
max = 1,
--bigStep = 0.01,
bigStep = 0.01,
order = 14,
isPercent = true
},
@@ -534,17 +534,11 @@ local function createOptions(id, data)
}
};
if OptionsPrivate.commonOptions then
return {
stopmotion = options,
position = OptionsPrivate.commonOptions.PositionOptions(id, data, 2),
};
else
return {
stopmotion = options,
position = WeakAuras.PositionOptions(id, data, 2),
};
end
return {
stopmotion = options,
progressOptions = OptionsPrivate.commonOptions.ProgressOptions(data),
position = OptionsPrivate.commonOptions.PositionOptions(id, data, 2),
}
end
local function createThumbnail()
+113 -24
View File
@@ -23,31 +23,51 @@ local function createOptions(parentData, data, index, subIndex)
order = 2,
hasAlpha = true,
},
tick_placement_mode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Tick Mode"],
order = 3,
values = OptionsPrivate.Private.tick_placement_modes,
},
tick_placement = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Tick Placement"],
order = 4,
validate = WeakAuras.ValidateNumeric,
desc = L["Enter in a value for the tick's placement."],
},
tick_thickness = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Thickness"],
order = 5,
order = 2.5,
min = 0,
softMax = 20,
step = 1,
},
tick_progress_source_space = {
type = "description",
name = "",
order = 3,
width = WeakAuras.normalWidth,
},
tick_placement_mode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Tick Mode"],
order = 3.1,
values = OptionsPrivate.Private.tick_placement_modes,
},
tick_progress_source_space_2 = {
type = "description",
name = "",
order = 3.2,
width = WeakAuras.normalWidth,
},
tick_add = {
type = "execute",
name = L["Add"],
order = 5,
width = WeakAuras.normalWidth,
func = function()
tinsert(data.tick_placements, 0)
WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id)
end
},
tick_extrasDescription = {
type = "execute",
control = "WeakAurasExpandSmall",
@@ -80,7 +100,7 @@ local function createOptions(parentData, data, index, subIndex)
return description
end,
width = WeakAuras.doubleWidth,
order = 6,
order = 7,
func = function(info, button)
local collapsed = OptionsPrivate.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
OptionsPrivate.SetCollapsed("subtext", "subtext", "tickextras" .. index, not collapsed)
@@ -99,7 +119,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Automatic length"],
order = 7,
order = 8,
desc = L["Matches the height setting of a horizontal bar or width for a vertical bar."],
hidden = hiddentickextras,
},
@@ -108,7 +128,7 @@ local function createOptions(parentData, data, index, subIndex)
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Length"],
order = 8,
order = 9,
min = 0,
softMax = 50,
step = 1,
@@ -119,14 +139,14 @@ local function createOptions(parentData, data, index, subIndex)
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Use Texture"],
order = 9,
order = 10,
hidden = hiddentickextras,
},
tick_blend_mode = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Blend Mode"],
order = 10,
order = 11,
values = OptionsPrivate.Private.blend_types,
disabled = function() return not data.use_texture end,
hidden = hiddentickextras,
@@ -134,7 +154,7 @@ local function createOptions(parentData, data, index, subIndex)
tick_texture = {
type = "input",
name = L["Texture"],
order = 11,
order = 12,
width = WeakAuras.doubleWidth - 0.15,
disabled = function() return not data.use_texture end,
hidden = hiddentickextras,
@@ -143,7 +163,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "execute",
name = L["Choose"],
width = 0.15,
order = 11.5,
order = 12.5,
func = function()
OptionsPrivate.OpenTexturePicker(parentData, {
"subRegions", index
@@ -164,7 +184,7 @@ local function createOptions(parentData, data, index, subIndex)
type = "toggle",
width = WeakAuras.doubleWidth,
name = L["Desaturate"],
order = 12,
order = 13,
hidden = hiddentickextras,
},
tick_rotation = {
@@ -174,6 +194,7 @@ local function createOptions(parentData, data, index, subIndex)
name = L["Rotation"],
min = 0,
max = 360,
step = 1,
order = 14,
hidden = hiddentickextras,
},
@@ -193,6 +214,7 @@ local function createOptions(parentData, data, index, subIndex)
order = 16,
softMin = -200,
softMax = 200,
step = 1,
hidden = hiddentickextras,
},
tick_yOffset = {
@@ -203,6 +225,7 @@ local function createOptions(parentData, data, index, subIndex)
order = 17,
softMin = -200,
softMax = 200,
step = 1,
hidden = hiddentickextras,
},
@@ -218,6 +241,72 @@ local function createOptions(parentData, data, index, subIndex)
}
}
if data then
for i in ipairs(data.tick_placements) do
options["tick_progress_source" .. i] = {
type = "select",
width = WeakAuras.normalWidth,
name = L["Progress Source"],
order = 4 + i / 100,
control = "WeakAurasTwoColumnDropdown",
values = OptionsPrivate.Private.GetProgressSourcesForUi(parentData, true),
get = function(info)
return OptionsPrivate.Private.GetProgressValueConstant(data.progressSources[i] or {-2, ""})
end,
set = function(info, value)
if value then
data.progressSources = data.progressSources or {}
data.progressSources[i] = data.progressSources[i] or {}
-- Copy only trigger + property
data.progressSources[i][1] = value[1]
data.progressSources[i][2] = value[2]
else
data.progressSources[i] = nil
end
WeakAuras.Add(parentData)
end,
hidden = function()
return not(data.tick_placement_mode == "ValueOffset")
end
}
options["tick_placement" .. i] = {
type = "input",
width = WeakAuras.normalWidth - 0.15,
name = L["Tick Placement"],
order = 4 + i / 100 + 0.001,
validate = WeakAuras.ValidateNumeric,
desc = L["Enter in a value for the tick's placement."],
get = function(info)
return data.tick_placements[i] or ""
end,
set = function(info, value)
data.tick_placements[i] = value
WeakAuras.Add(parentData)
end
}
options["tick_placement_delete" .. i] = {
type = "execute",
width = 0.15,
name = L["Delete"],
order = 4 + i / 100 + 0.002,
func = function()
tremove(data.tick_placements, i)
WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id)
end,
image = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\delete",
imageWidth = 24,
imageHeight = 24,
control = "WeakAurasIcon",
disabled = function()
return #data.tick_placements < 2
end
}
end
end
OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, "subtick")
return options