KeySelection: start select mode when page is turned during text selection, see https://github.com/koreader/koreader/issues/13132
This commit is contained in:
1 parent
2c0f541516
commit
0f01690a19
2 files changed
+28
No files matched your search
@@ -225,6 +225,10 @@ function ReaderKeySelection:onStartOrMoveHighlightIndicator(args)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderKeySelection:isActive()
|
||||
return self._current_indicator_pos ~= nil
|
||||
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
|
||||
@@ -406,6 +410,27 @@ function ReaderKeySelection:moveHighlightIndicator(args)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderKeySelection:pageTurnDuringSelection()
|
||||
self._edge_dx, self._edge_dy = nil, nil
|
||||
self._previous_indicator_word = nil
|
||||
local last_pos = self._current_indicator_pos
|
||||
local target_x = last_pos.x + last_pos.w * 0.5
|
||||
local target_y = last_pos.y + last_pos.h * 0.5
|
||||
|
||||
local new_word = self:_getNearestWordFromScreenPoint(target_x, target_y)
|
||||
if new_word then
|
||||
self:_setIndicatorToWord(new_word)
|
||||
if not self.ui.highlight.select_mode and self._start_indicator_highlight then
|
||||
self.ui.highlight:startSelection()
|
||||
-- we don't want to HoldPan during moveHighlightIndicator, a following Press
|
||||
-- key should close the startSelection loop though.
|
||||
self._start_indicator_highlight = nil -- breaks the `if moved and self._ then`
|
||||
end
|
||||
else
|
||||
self:stopHighlightIndicator(true)
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderKeySelection:_isSingleWord(word)
|
||||
if not word or not word.word then return false end
|
||||
local trimmed_word = word.word:match("^%s*(.-)%s*$") or word.word
|
||||
|
||||
Reference in new issue
Block a user