[touchmenu] simplify code and finish early (#14113)

This commit is contained in:
zwim
2025-07-30 16:29:36 +02:00
committed by GitHub
parent a674bc8510
commit 400c774bcc
5 changed files with 67 additions and 81 deletions

View File

@@ -127,7 +127,7 @@ function CheckButton:onTapCheckButton()
if not self.enabled then return true end
if self.tap_input then
self:onInput(self.tap_input)
elseif type(self.tap_input_func) == "function" then
elseif self.tap_input_func then
self:onInput(self.tap_input_func())
else
if G_reader_settings:isFalse("flash_ui") then
@@ -184,7 +184,7 @@ function CheckButton:onHoldCheckButton()
elseif self.hold_input then
self:onInput(self.hold_input, true)
self._hold_handled = true
elseif type(self.hold_input_func) == "function" then
elseif self.hold_input_func then
self:onInput(self.hold_input_func(), true)
self._hold_handled = true
end