Skip to content

Commit

Permalink
Merge pull request DFHack#4382 from myk002/myk_single_click_button
Browse files Browse the repository at this point in the history
[orders] single click button to toggle labor
  • Loading branch information
myk002 authored Mar 18, 2024
2 parents 751e0b6 + d420c41 commit 9f5eee7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/lua/orders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,21 @@ function make_labor_panel(bld_type, bld_subtype, labors)
},
}

panel.onInput = function(self, keys)
local handled = widgets.Panel.onInput(self, keys)
if keys._MOUSE_L then
local idx = list:getIdxUnderMouse()
if idx then
local x = list:getMousePos()
if x <= 2 then
toggle_labor(list:getSelected())
list.last_select_click_ms = 0
end
end
end
return handled
end

local choices = {}
for _,labor_name in ipairs(labors) do
local labor = df.unit_labor[labor_name]
Expand Down

0 comments on commit 9f5eee7

Please sign in to comment.