mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix visibility() which was broken similar to pos_for_elem()
This commit is contained in:
parent
d7259dd2e2
commit
9a9f35ae43
@ -564,21 +564,16 @@ anchor_funcs = {
|
|||||||
scroll_viewport.rect_block_start(br), elem.ownerDocument), scroll_viewport.viewport_to_document_inline(scroll_viewport.rect_inline_start(br))
|
scroll_viewport.rect_block_start(br), elem.ownerDocument), scroll_viewport.viewport_to_document_inline(scroll_viewport.rect_inline_start(br))
|
||||||
,
|
,
|
||||||
'visibility': def visibility(pos):
|
'visibility': def visibility(pos):
|
||||||
x, y = pos
|
y, x = pos
|
||||||
|
q = y if scroll_viewport.horizontal_writing_mode else x
|
||||||
if jstype(x) is 'number':
|
|
||||||
pos = x
|
|
||||||
if jstype(y) is 'number' and scroll_viewport.horizontal_writing_mode:
|
|
||||||
pos = y
|
|
||||||
|
|
||||||
# Have to negate X if in RTL for the math to be correct,
|
# Have to negate X if in RTL for the math to be correct,
|
||||||
# as the value that the scroll viewport returns is negated
|
# as the value that the scroll viewport returns is negated
|
||||||
if scroll_viewport.vertical_writing_mode and scroll_viewport.rtl:
|
if scroll_viewport.vertical_writing_mode and scroll_viewport.rtl:
|
||||||
pos = -pos
|
q = -q
|
||||||
|
|
||||||
if pos < scroll_viewport.block_pos():
|
if q < scroll_viewport.block_pos():
|
||||||
return -1
|
return -1
|
||||||
if pos <= scroll_viewport.block_pos() + scroll_viewport.block_size():
|
if q <= scroll_viewport.block_pos() + scroll_viewport.block_size():
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
,
|
,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user