|
|
|
@ -214,6 +214,11 @@ function ReaderHighlight:init()
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- default value for non-touch content selection speed-up rate
|
|
|
|
|
if G_reader_settings:hasNot("highlight_non_touch_spedup") then
|
|
|
|
|
G_reader_settings:makeTrue("highlight_non_touch_spedup")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self.ui:registerPostInitCallback(function()
|
|
|
|
|
self.ui.menu:registerToMainMenu(self)
|
|
|
|
|
end)
|
|
|
|
@ -581,6 +586,7 @@ function ReaderHighlight:addToMainMenu(menu_items)
|
|
|
|
|
help_text = _([[
|
|
|
|
|
Auto-scroll to show part of the previous page when your text selection reaches the top left corner, or of the next page when it reaches the bottom right corner.
|
|
|
|
|
Except when in two columns mode, where this is limited to showing only the previous or next column.]]),
|
|
|
|
|
separator = true,
|
|
|
|
|
checked_func = function()
|
|
|
|
|
if self.ui.paging then return false end
|
|
|
|
|
return not self.view.highlight.disabled and G_reader_settings:nilOrTrue("highlight_corner_scroll")
|
|
|
|
@ -624,6 +630,20 @@ Except when in two columns mode, where this is limited to showing only the previ
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
if not Device:isTouchDevice() and Device:hasDPad() then
|
|
|
|
|
table.insert(menu_items.long_press.sub_item_table, {
|
|
|
|
|
text = _("Speed-up rate on consecutive keystrokes"),
|
|
|
|
|
checked_func = function()
|
|
|
|
|
return G_reader_settings:isTrue("highlight_non_touch_spedup")
|
|
|
|
|
end,
|
|
|
|
|
enabled_func = function()
|
|
|
|
|
return not self.view.highlight.disabled
|
|
|
|
|
end,
|
|
|
|
|
callback = function()
|
|
|
|
|
G_reader_settings:toggle("highlight_non_touch_spedup")
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- long_press menu is under taps_and_gestures menu which is not available for non touch device
|
|
|
|
|
-- Clone long_press menu and change label making much meaning for non touch devices
|
|
|
|
@ -2216,12 +2236,12 @@ function ReaderHighlight:onMoveHighlightIndicator(args)
|
|
|
|
|
local now = time:now()
|
|
|
|
|
if dx == self._last_indicator_move_args.dx and dy == self._last_indicator_move_args.dy then
|
|
|
|
|
local diff = now - self._last_indicator_move_args.time
|
|
|
|
|
-- if press same arrow key in 1 second, speed up
|
|
|
|
|
-- if user presses same arrow key within 1 second, speed up
|
|
|
|
|
-- double press: 4 single move distances, usually move to next word or line
|
|
|
|
|
-- triple press: 16 single distances, usually skip several words or lines
|
|
|
|
|
-- quadruple press: 54 single distances, almost move to screen edge
|
|
|
|
|
if not ( Device:hasPageUpDownKeys() and Device:hasDPad() ) then
|
|
|
|
|
-- does not apply (for now..?) to newer (relatively) non-touch devices, i.e kindle 4
|
|
|
|
|
if G_reader_settings:isTrue("highlight_non_touch_spedup") then
|
|
|
|
|
-- user selects whether to use 'constant' or [this] 'sped up' rate (speed-up on by default)
|
|
|
|
|
if diff < time.s(1) then
|
|
|
|
|
move_distance = self._last_indicator_move_args.distance * 4
|
|
|
|
|
end
|
|
|
|
|