mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Adjust limits used for at_current() loop
This commit is contained in:
parent
bca1ef5767
commit
603b9b70ff
@ -821,20 +821,16 @@ def at_point(x, y): # {{{
|
||||
# }}}
|
||||
|
||||
def at_current(): # {{{
|
||||
wini, winb = scroll_viewport.inline_size(), scroll_viewport.block_size()
|
||||
|
||||
# We subtract one because the the actual position query for CFI elements is relative to the
|
||||
# We subtract one because the actual position query for CFI elements is relative to the
|
||||
# viewport, and the viewport coordinates actually go from 0 to the size - 1.
|
||||
# If we don't do this, the first line of queries will always fail in those cases where we
|
||||
# start at the right of the viewport because they'll be outside the viewport
|
||||
wini -= 1
|
||||
winb -= 1
|
||||
wini, winb = scroll_viewport.inline_size() - 1, scroll_viewport.block_size() - 1
|
||||
|
||||
# Don't let the deltas go below 10 or above 30, to prevent perverse cases where
|
||||
# Don't let the deltas go too small or too large, to prevent perverse cases where
|
||||
# we don't loop at all, loop too many times, or skip elements because we're
|
||||
# looping too fast.
|
||||
deltai = min(max(Math.ceil(rem_size() / 2), 5), 30)
|
||||
deltab = min(max(Math.ceil(rem_size() / 2), 5), 30)
|
||||
deltai = deltab = max(8, min(Math.ceil(rem_size() / 2), 32))
|
||||
|
||||
# i.e. English, Hebrew:
|
||||
if scroll_viewport.horizontal_writing_mode:
|
||||
|
Loading…
x
Reference in New Issue
Block a user