Skip to content

Commit 4ec28c3

Browse files
LocalIdentityLocalIdentity
andauthored
Default to last added Tattoo in Tattoo popup (#8215)
Adding multiple Tattoos is a pain when you have to re-enter the name of the Tattoo every time you are trying to add another copy of it Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent f6ee17f commit 4ec28c3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Classes/TreeTab.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build)
172172
self.controls.findTimelessJewel = new("ButtonControl", { "LEFT", self.controls.treeSearch, "RIGHT" }, 8, 0, 150, 20, "Find Timeless Jewel", function()
173173
self:FindTimelessJewel()
174174
end)
175+
176+
--Default index for Tattoos
177+
self.defaultTattoo = { }
175178

176179
-- Show Node Power Checkbox
177180
self.controls.treeHeatMap = new("CheckBoxControl", { "LEFT", self.controls.findTimelessJewel, "RIGHT" }, 130, 0, 20, "Show Node Power:", function(state)
@@ -733,11 +736,11 @@ end
733736
function TreeTabClass:ModifyNodePopup(selectedNode)
734737
local controls = { }
735738
local modGroups = { }
739+
local treeNodes = self.build.spec.tree.nodes
740+
local nodeName = treeNodes[selectedNode.id].dn
736741
local function buildMods(selectedNode)
737742
wipeTable(modGroups)
738-
local treeNodes = self.build.spec.tree.nodes
739743
local numLinkedNodes = selectedNode.linkedId and #selectedNode.linkedId or 0
740-
local nodeName = treeNodes[selectedNode.id].dn
741744
local nodeValue = treeNodes[selectedNode.id].sd[1]
742745
for id, node in pairs(self.build.spec.tree.tattoo.nodes) do
743746
if (nodeName:match(node.targetType:gsub("^Small ", "")) or (node.targetValue ~= "" and nodeValue:match(node.targetValue)) or
@@ -806,6 +809,7 @@ function TreeTabClass:ModifyNodePopup(selectedNode)
806809
buildMods(selectedNode)
807810
controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 150, 25, 0, 16, "^7Modifier:")
808811
controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 155, 25, 250, 18, modGroups, function(idx) constructUI(modGroups[idx]) end)
812+
controls.modSelect.selIndex = self.defaultTattoo[nodeName] or 1
809813
controls.modSelect.tooltipFunc = function(tooltip, mode, index, value)
810814
tooltip:Clear()
811815
if mode ~= "OUT" and value then
@@ -818,6 +822,7 @@ function TreeTabClass:ModifyNodePopup(selectedNode)
818822
addModifier(selectedNode)
819823
self.modFlag = true
820824
self.build.buildFlag = true
825+
self.defaultTattoo[nodeName] = controls.modSelect.selIndex
821826
main:ClosePopup()
822827
end)
823828
controls.reset = new("ButtonControl", nil, 0, 75, 80, 20, "Reset Node", function()
@@ -844,7 +849,7 @@ function TreeTabClass:ModifyNodePopup(selectedNode)
844849
end
845850
controls.totalTattoos = new("LabelControl", nil, 0, 95, 0, 16, "^7Tattoo Count: ".. getTattooCount() .."/50" )
846851
main:OpenPopup(600, 105, "Replace Modifier of Node", controls, "save")
847-
constructUI(modGroups[1])
852+
constructUI(modGroups[self.defaultTattoo[nodeName] or 1])
848853

849854
-- Show Legacy Tattoos
850855
controls.showLegacyTattoo = new("CheckBoxControl", { "LEFT", controls.totalTattoos, "RIGHT" }, 205, 0, 20, "Show Legacy Tattoos:", function(state)

0 commit comments

Comments
 (0)