Skip to content

Commit eeaf54f

Browse files
committed
improvements to Imbued GemSelect, process/buildFlag less often and clean up imbued after fully backspacing
1 parent f23adba commit eeaf54f

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/Classes/GemSelectControl.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ end
378378

379379
function GemSelectClass:UpdateGem(setText, addUndo)
380380
local gemId = self.list[m_max(self.selIndex, 1)]
381-
if self.buf:match("%S") and self.gems[gemId] then
381+
local bufMatchesGem = (self.gems[gemId] and self.buf:lower() == self.gems[gemId].name:lower()) -- currently only for imbued GemControl: don't process unless the buffer equals an actual gem, whether typed, clicked, or navigated with arrows
382+
383+
if self.gems[gemId] and (not self.imbuedSelect or bufMatchesGem) then
382384
self.gemId = gemId
383385
else
384386
self.gemId = nil

src/Classes/SkillsTab.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,14 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
233233
self.controls.imbuedSupport.inactiveCol = data.skillColorMap[gem.grantedEffect.color]
234234
self.build.buildFlag = true
235235
else
236+
local cleanUp = self.imbuedSupportBySlot[targetSlot]
236237
self.imbuedSupportBySlot[targetSlot] = nil
237238
if updateDisplayGroup then
238239
self.displayGroup.imbuedSupport = nil
239240
end
241+
if cleanUp then -- an imbued existed before clearing it, so reprocess
242+
self.build.buildFlag = true
243+
end
240244
end
241245
end, true, true)
242246
local function isImbuedEnabled() -- socketedIn must be set and the displayGroup must have an imbued, otherwise disable the imbued dropdown
@@ -251,9 +255,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
251255
self.controls.imbuedSupportClear = new("ButtonControl", { "LEFT", self.controls.imbuedSupportLabel, "RIGHT" }, { 260, 0, 20, 20}, "x", function()
252256
self.controls.imbuedSupport.gemId = nil
253257
self.controls.imbuedSupport:SetText("")
254-
self.displayGroup.imbuedSupport = nil
255-
self.imbuedSupportBySlot[self.displayGroup.slot] = nil
256-
self.build.buildFlag = true
258+
self.controls.imbuedSupport:gemChangeFunc(nil)
257259
end)
258260
self.controls.imbuedSupportClear.enabled = function()
259261
return isImbuedEnabled()

0 commit comments

Comments
 (0)