mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Viewer: add a delay/pause when scrolling through a boundary in Flow mode
This commit is contained in:
parent
3e957aa58b
commit
90e0fa9e92
@ -83,8 +83,17 @@ def _check_for_scroll_end(func, obj, args, report):
|
||||
|
||||
if scroll_viewport.block_pos() is before:
|
||||
csi = current_spine_item()
|
||||
## ignore duplicate requests
|
||||
if last_change_spine_item_request.name is csi.name and now - last_change_spine_item_request.at < 2000:
|
||||
return False
|
||||
## delay change on boundaries
|
||||
if opts.scroll_stop_boundaries :
|
||||
if last_change_spine_item_request.ignoreUntil is None :
|
||||
last_change_spine_item_request.ignoreUntil = now + 500
|
||||
if now < last_change_spine_item_request.ignoreUntil:
|
||||
return False
|
||||
last_change_spine_item_request.ignoreUntil = None
|
||||
# perform change
|
||||
last_change_spine_item_request.name = csi.name
|
||||
last_change_spine_item_request.at = now
|
||||
go_to_previous_page = args[0] < 0
|
||||
@ -92,6 +101,7 @@ def _check_for_scroll_end(func, obj, args, report):
|
||||
go_to_previous_page = not go_to_previous_page
|
||||
get_boss().send_message('next_spine_item', previous=go_to_previous_page)
|
||||
return False
|
||||
last_change_spine_item_request.ignoreUntil = None
|
||||
if report:
|
||||
report_human_scroll(scroll_viewport.block_pos() - before)
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user