Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Init/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,10 @@ function CraftSim.INIT:HideAllModules(keepControlPanel)
end
-- hide all modules
CraftSim.RECIPE_SCAN.frame:Hide()
CraftSim.CRAFTQ.frame:Hide()
-- Skip hiding CraftQueue frame if user is editing a craft amount input
if not (CraftSim.CRAFTQ.UI and CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput()) then
CraftSim.CRAFTQ.frame:Hide()
end
Comment on lines +526 to +529
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think thats necessary.

the modules are all set to hidden here as a default.
in the lower lines all modules are then checked if they are enabled and if it makes sense to show them (e.g. runecrafting wont show craftsim modules although its a 'profession')

so in that case if craftqueue was visible before it will also be still visible afterwards

CraftSim.CRAFT_BUFFS.frame:Hide()
CraftSim.CRAFT_BUFFS.frameWO:Hide()
CraftSim.COOLDOWNS.frame:Hide()
Expand Down Expand Up @@ -725,8 +728,11 @@ function CraftSim.INIT:TriggerModulesByRecipeType()
end

-- update CraftQ Display (e.g. cause of profession gear changes)
CraftSim.CRAFTQ.UI:UpdateDisplay()
CraftSim.CRAFTQ.UI:UpdateAddOpenRecipeButton(recipeData)
-- Skip CraftQueue update if user is editing a craft amount input to prevent focus loss
if not (CraftSim.CRAFTQ.UI.HasFocusedInput and CraftSim.CRAFTQ.UI:HasFocusedInput()) then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not necessary to check if the function exists before calling it here.
the function declarations are all processed before the init code is executed

CraftSim.CRAFTQ.UI:UpdateDisplay()
CraftSim.CRAFTQ.UI:UpdateAddOpenRecipeButton(recipeData)
end

-- Simulation Mode (always update first because it changes recipeData based on simMode inputs)
showSimulationMode = (showSimulationMode and recipeData and not recipeData.isSalvageRecipe) or false
Expand Down
19 changes: 19 additions & 0 deletions Modules/CraftQueue/UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,25 @@ function CraftSim.CRAFTQ.UI:UpdateDisplay()
CraftSim.CRAFTQ.UI:UpdateQueueDisplay()
end

--- Returns true if any craft amount input in the queue list currently has focus
function CraftSim.CRAFTQ.UI:HasFocusedInput()
local queueTab = CraftSim.CRAFTQ.frame and CraftSim.CRAFTQ.frame.content and
CraftSim.CRAFTQ.frame.content.queueTab
if not queueTab then return false end
local craftList = queueTab.content and queueTab.content.craftList
if not craftList or not craftList.activeRows then return false end
for _, row in pairs(craftList.activeRows) do
local craftAmountColumn = row.columns and row.columns[9]
if craftAmountColumn and craftAmountColumn.input and
craftAmountColumn.input.textInput and
craftAmountColumn.input.textInput.frame and
craftAmountColumn.input.textInput.frame:HasFocus() then
return true
end
end
return false
end

---@param craftQueueItem CraftSim.CraftQueueItem
function CraftSim.CRAFTQ.UI:UpdateEditRecipeFrameDisplay(craftQueueItem)
---@type CraftSim.CRAFTQ.EditRecipeFrame
Expand Down