E-book viewer: Fix selection popup not showing for some books on some platforms when the selection is in the top line. Fixes #2024375 [Private bug](https://bugs.launchpad.net/calibre/+bug/2024375)

This commit is contained in:
Kovid Goyal 2023-06-23 09:28:24 +05:30
parent fd3a42cee8
commit e7f8ee5cd6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -95,7 +95,10 @@ def range_extents(q, in_flow_mode):
end = q.cloneRange()
def rect_onscreen(r):
if r.right <= window.innerWidth and r.bottom <= window.innerHeight and r.left >= 0 and r.top >= 0:
# we use -1 rather than zero for the top limit because on some
# platforms the browser engine returns that for top line selections.
# See https://bugs.launchpad.net/calibre/+bug/2024375/ for a test case.
if r.right <= window.innerWidth and r.bottom <= window.innerHeight and r.left >= 0 and r.top >= -1:
return True
return False