mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
E-book viewer: Make CFI calculation more robust especially on pages with very little content. Fixes #2037454 [E-book viewer: "Back" button doesn't work under some conditions](https://bugs.launchpad.net/calibre/+bug/2037454)
We were only testing two x values per y value. Instead test all 48.
This commit is contained in:
parent
a3ae1ad46e
commit
ff3af3ac15
@ -618,11 +618,12 @@ def current_cfi():
|
||||
if yb <= top or ya >= bottom:
|
||||
break
|
||||
yidx += 1
|
||||
xidx = 0
|
||||
ys = v'[ya]' if ya is yb else v'[yb, ya]'
|
||||
for cury in ys:
|
||||
xidx = 0
|
||||
while True:
|
||||
xb, xa = midx - xidx * deltax, midx + xidx * deltax
|
||||
if xa <= left or xb >= right:
|
||||
if xb <= left or xa >= right:
|
||||
break
|
||||
xidx += 1
|
||||
xs = v'[xa]' if xa is xb else v'[xb, xa]'
|
||||
|
Loading…
x
Reference in New Issue
Block a user