From 769dbadf62cf9bf01684377d515c3c170fae6e47 Mon Sep 17 00:00:00 2001 From: Trifall Date: Sat, 8 Aug 2026 04:25:12 -0400 Subject: [PATCH] add visibility check for custom mod item sections --- spec/System/TestItemMods_spec.lua | 23 +++++++++++++++++++++++ src/Classes/ItemsTab.lua | 3 +++ 2 files changed, 26 insertions(+) diff --git a/spec/System/TestItemMods_spec.lua b/spec/System/TestItemMods_spec.lua index f7d63f0956..2569b08fc7 100644 --- a/spec/System/TestItemMods_spec.lua +++ b/spec/System/TestItemMods_spec.lua @@ -859,6 +859,29 @@ describe("TetsItemMods", function() assert.is_true(controls.displayItemCustomModifierRemove1:IsShown()) end) + it("hides custom modifier controls after saving the display item", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + Rarity: RARE + Test Item + Iron Ring + Implicits: 1 + Adds 1 to 4 Physical Damage to Attacks + {crafted}+8 to Strength + ]]) + + local controls = build.itemsTab.controls + assert.is_true(controls.displayItemCustomModifierRemove1:IsShown()) + assert.is_true(controls.displayItemCustomModifier1:IsShown()) + + build.itemsTab:AddDisplayItem() + + assert.is_nil(build.itemsTab.displayItem) + assert.is_falsy(controls.displayItemSectionCustom:IsShown()) + assert.is_falsy(controls.displayItemCustomModifierRemove1:IsShown()) + assert.is_falsy(controls.displayItemCustomModifier1:IsShown()) + assert.is_falsy(controls.displayItemCustomModifierLabel1:IsShown()) + end) + it("shows affix controls for items crafted in Path of Building", function() build.itemsTab:CreateDisplayItemFromRaw([[ Rarity: RARE diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 1380881c02..31a5a1c6dd 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -985,6 +985,9 @@ holding Shift will put it in the second.]]) self.controls.displayItemSectionCustom = new("Control", {"TOPLEFT",self.controls.displayItemSectionAffix,"BOTTOMLEFT",true}, {0, 0, 0, function() return (self.controls.displayItemAddCustom:IsShown() or self.controls.displayItemAddCrucible:IsShown()) and 28 + self.displayItem.customCount * 22 or 0 end}) + self.controls.displayItemSectionCustom.shown = function() + return self.displayItem ~= nil + end self.controls.displayItemAddCustom = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, {0, 0, 120, 20}, "Add modifier...", function() self:AddCustomModifierToDisplayItem() end)