mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ButtonTable: reset MovableContainer state on button tap
Prevent any later hold_release event from being handled by MovableContainer as a moving touch+hold_release. This issue was noticable when closing DictQuickLookup with long-press on close, resulting in the movable highlight actions ButtonTable moving to where the long-press happened.
This commit is contained in:
@@ -55,7 +55,12 @@ function ButtonTable:init()
|
||||
icon_height = btn_entry.icon_height,
|
||||
align = btn_entry.align,
|
||||
enabled = btn_entry.enabled,
|
||||
callback = btn_entry.callback,
|
||||
callback = function()
|
||||
if self.show_parent and self.show_parent.movable then
|
||||
self.show_parent.movable:resetEventState()
|
||||
end
|
||||
btn_entry.callback()
|
||||
end,
|
||||
hold_callback = btn_entry.hold_callback,
|
||||
allow_hold_when_disabled = btn_entry.allow_hold_when_disabled,
|
||||
vsync = btn_entry.vsync,
|
||||
|
||||
@@ -342,4 +342,11 @@ function MovableContainer:onMovablePanRelease(_, ges)
|
||||
return false
|
||||
end
|
||||
|
||||
function MovableContainer:resetEventState()
|
||||
-- Cancel some internal moving-or-about-to-move state.
|
||||
-- Can be called explicitely to prevent bad widget interactions.
|
||||
self._touch_pre_pan_was_inside = false
|
||||
self._moving = false
|
||||
end
|
||||
|
||||
return MovableContainer
|
||||
|
||||
Reference in New Issue
Block a user