Skip to content

Commit

Permalink
Fix Cancel convert atlas version back to previous value in dropdown (#…
Browse files Browse the repository at this point in the history
…7904)

Co-authored-by: justjuangui <servicios@juacarvajal.com>
  • Loading branch information
justjuangui and justjuangui authored Jul 25, 2024
1 parent 0fcc0a7 commit cb840b8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Classes/TreeTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,16 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
-- Tree Version Dropdown
self.treeVersions = { }
for _, num in ipairs(treeVersionList) do
t_insert(self.treeVersions, treeVersions[num].display)
local value = {
label = treeVersions[num].display,
value = num
}
t_insert(self.treeVersions, value)
end
self.controls.versionText = new("LabelControl", { "LEFT", self.controls.reset, "RIGHT" }, 8, 0, 0, 16, "Version:")
self.controls.versionSelect = new("DropDownControl", { "LEFT", self.controls.versionText, "RIGHT" }, 8, 0, 100, 20, self.treeVersions, function(index, value)
if value ~= self.build.spec.treeVersion then
self:OpenVersionConvertPopup(value:gsub("[%(%)]", ""):gsub("[%.%s]", "_"), true)
self.controls.versionSelect = new("DropDownControl", { "LEFT", self.controls.versionText, "RIGHT" }, 8, 0, 100, 20, self.treeVersions, function(index, selected)
if selected.value ~= self.build.spec.treeVersion then
self:OpenVersionConvertPopup(selected.value, true)
end
end)
self.controls.versionSelect.maxDroppedWidth = 1000
Expand Down Expand Up @@ -467,7 +471,7 @@ function TreeTabClass:SetActiveSpec(specId)
self.build.itemsTab.controls.specSelect.selIndex = specId
-- Update Version dropdown to active spec's
if self.controls.versionSelect then
self.controls.versionSelect:SelByValue(curSpec.treeVersion:gsub("%_", "."):gsub(".ruthless", " (ruthless)"))
self.controls.versionSelect:SelByValue(curSpec.treeVersion, 'value')
end

-- set the loadout option to the dummy option since it is now dirty
Expand Down Expand Up @@ -556,6 +560,7 @@ function TreeTabClass:OpenVersionConvertPopup(version, ignoreRuthlessCheck)
main:ClosePopup()
end)
controls.cancel = new("ButtonControl", nil, 125, 105, 100, 20, "Cancel", function()
self.controls.versionSelect:SelByValue(self.build.spec.treeVersion, 'value')
main:ClosePopup()
end)
main:OpenPopup(570, 140, "Convert to Version "..treeVersions[version].display, controls, "convert", "edit")
Expand Down

0 comments on commit cb840b8

Please sign in to comment.