restore pokeball (long_hold_reached_action) after key selection ends (#16132)

This commit is contained in:
David authored and GitHub committed 2026-10-01 12:02:13 +01:00
1 parent b539d24b97
commit 0563d799a6
2 files changed
+32 -7

No files matched your search

@@ -435,8 +435,9 @@ function ReaderKeySelection:clearFlashHighlight()
end
function ReaderKeySelection:startHighlightIndicator()
-- disable long-press icon (poke-ball), as it is triggered constantly due to NT devices needing a workaround for text selection to work.
self.ui.highlight.long_hold_reached_action = function() end
-- disable long-press icon (poke-ball), as it is triggered constantly due
-- to NT devices needing a workaround for text selection to work.
self.ui.highlight:disableLongHoldReachedAction()
if self.view.visible_area and not self._current_indicator_pos then
local rect = self._previous_indicator_pos
-- set start position to centre of page
@@ -516,6 +517,7 @@ end
function ReaderKeySelection:stopHighlightIndicator(need_clear_selection)
if not self._current_indicator_pos then return false end
self.ui.highlight:restoreLongHoldReachedAction()
-- If we're in select mode and user presses back, end the selection
if self.ui.highlight.select_mode and self.ui.highlight.highlight_idx then
self.ui.highlight.select_mode = false
@@ -579,8 +581,9 @@ function ReaderKeySelection:highlightModifierPress()
return true -- don't trigger hotkeys during text selection
end
-- Simulate very long-long press by setting the long hold flag. This will trigger the long-press dialog.
self.ui.highlight.long_hold_reached = true
self.ui.highlight:setLongHoldReached(true)
self.ui.highlight:onHoldRelease(nil, self:_createHighlightGesture("hold_release"))
self.ui.highlight:setLongHoldReached(false)
self:stopHighlightIndicator()
return true
end