Skip to content

Commit 08ba01e

Browse files
committed
[ISSUE-9451] Loadout Management
* Restored Tree Management copy functionality * Implemented a default name for the New Tree button * Set a default name for the spec title for the case of renaming or copying the default spec.
1 parent f3ffc87 commit 08ba01e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Classes/PassiveSpecListControl.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ local m_max = math.max
1010
local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", function(self, anchor, rect, treeTab)
1111
self.ListControl(anchor, rect, 16, "VERTICAL", true, treeTab.specList)
1212
self.treeTab = treeTab
13-
self.controls.copy = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, {2, -4, 60, 18}, "Copy", function()
14-
local newSpec = treeTab:CopyTree(self.selIndex)
15-
self:RenameSpec(newSpec, "Copy Tree")
13+
self.controls.copy = new("ButtonControl", { "BOTTOMLEFT", self, "TOP" }, { 2, -4, 60, 18 }, "Copy", function()
14+
local newSpec = new("PassiveSpec", treeTab.build, self.selValue.treeVersion)
15+
newSpec.title = self.selValue.title
16+
newSpec.jewels = copyTable(self.selValue.jewels)
17+
newSpec:RestoreUndoState(self.selValue:CreateUndoState())
18+
newSpec:BuildClusterJewelGraphs()
19+
self:RenameSpec(newSpec, "Copy Tree", true)
1620
end)
1721
self.controls.copy.enabled = function()
1822
return self.selValue ~= nil
@@ -31,6 +35,7 @@ local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", f
3135
end
3236
self.controls.new = new("ButtonControl", {"RIGHT",self.controls.rename,"LEFT"}, {-4, 0, 60, 18}, "New", function()
3337
local newSpec = new("PassiveSpec", treeTab.build, latestTreeVersion)
38+
newSpec.title = "New Tree"
3439
newSpec:SelectClass(treeTab.build.spec.curClassId)
3540
newSpec:SelectAscendClass(treeTab.build.spec.curAscendClassId)
3641
newSpec:SelectSecondaryAscendClass(treeTab.build.spec.curSecondaryAscendClassId)
@@ -42,7 +47,7 @@ end)
4247
function PassiveSpecListClass:RenameSpec(spec, popupTitle, addOnName)
4348
local controls = { }
4449
controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this passive tree:")
45-
controls.edit = new("EditControl", nil, {0, 40, 350, 20}, spec.title, nil, nil, 100, function(buf)
50+
controls.edit = new("EditControl", nil, {0, 40, 350, 20}, spec.title or "Default", nil, nil, 100, function(buf)
4651
controls.save.enabled = buf:match("%S")
4752
end)
4853
controls.save = new("ButtonControl", nil, {-45, 70, 80, 20}, "Save", function()

0 commit comments

Comments
 (0)