allow mouse lclick to select a List item

develop
myk002 2022-07-16 22:18:38 -07:00
parent f65f36ffee
commit 805456e82b
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 9 additions and 0 deletions

@ -1019,6 +1019,15 @@ function List:onInput(keys)
elseif self.on_submit2 and keys.SEC_SELECT then
self:submit2()
return true
elseif keys._MOUSE_L then
local _, mouse_y = self:getMousePos()
if mouse_y and #self.choices > 0 and
mouse_y < (#self.choices-self.page_top+1) * self.row_height then
local idx = self.page_top + math.floor(mouse_y/self.row_height)
self:setSelected(idx)
self:submit()
return true
end
else
for k,v in pairs(self.scroll_keys) do
if keys[k] then