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.
pull/9991/head
poire-z 1 year ago
parent cbe7775bc8
commit bbbcdffd3b

@ -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

Loading…
Cancel
Save