Skip to content

Commit 9f5eee7

Browse files
authored
Merge pull request #4382 from myk002/myk_single_click_button
[orders] single click button to toggle labor
2 parents 751e0b6 + d420c41 commit 9f5eee7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

plugins/lua/orders.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,21 @@ function make_labor_panel(bld_type, bld_subtype, labors)
574574
},
575575
}
576576

577+
panel.onInput = function(self, keys)
578+
local handled = widgets.Panel.onInput(self, keys)
579+
if keys._MOUSE_L then
580+
local idx = list:getIdxUnderMouse()
581+
if idx then
582+
local x = list:getMousePos()
583+
if x <= 2 then
584+
toggle_labor(list:getSelected())
585+
list.last_select_click_ms = 0
586+
end
587+
end
588+
end
589+
return handled
590+
end
591+
577592
local choices = {}
578593
for _,labor_name in ipairs(labors) do
579594
local labor = df.unit_labor[labor_name]

0 commit comments

Comments
 (0)