mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -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:
|
if yb <= top or ya >= bottom:
|
||||||
break
|
break
|
||||||
yidx += 1
|
yidx += 1
|
||||||
xidx = 0
|
|
||||||
ys = v'[ya]' if ya is yb else v'[yb, ya]'
|
ys = v'[ya]' if ya is yb else v'[yb, ya]'
|
||||||
for cury in ys:
|
for cury in ys:
|
||||||
|
xidx = 0
|
||||||
|
while True:
|
||||||
xb, xa = midx - xidx * deltax, midx + xidx * deltax
|
xb, xa = midx - xidx * deltax, midx + xidx * deltax
|
||||||
if xa <= left or xb >= right:
|
if xb <= left or xa >= right:
|
||||||
break
|
break
|
||||||
xidx += 1
|
xidx += 1
|
||||||
xs = v'[xa]' if xa is xb else v'[xb, xa]'
|
xs = v'[xa]' if xa is xb else v'[xb, xa]'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user