mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix positioning of completion popup above widgets
This commit is contained in:
parent
c40995b2b6
commit
df1d52a7ef
@ -45,7 +45,9 @@ def create_popup(parent, idprefix):
|
|||||||
nonlocal popup_count
|
nonlocal popup_count
|
||||||
popup_count += 1
|
popup_count += 1
|
||||||
pid = (idprefix or 'popup') + '-' + popup_count
|
pid = (idprefix or 'popup') + '-' + popup_count
|
||||||
div = E.div(id=pid, style='display: none; position: absolute; z-index: {}'.format(POPUP_Z_INDEX))
|
# Position has to be fixed so that setting style.top/style.bottom works in
|
||||||
|
# viewport co-ordinates
|
||||||
|
div = E.div(id=pid, style='display: none; position: fixed; z-index: {}'.format(POPUP_Z_INDEX))
|
||||||
parent = parent or document.body
|
parent = parent or document.body
|
||||||
parent.appendChild(div)
|
parent.appendChild(div)
|
||||||
return div
|
return div
|
||||||
@ -166,7 +168,7 @@ class CompletionPopup:
|
|||||||
cs = c.style
|
cs = c.style
|
||||||
cs.left = x + 'px'
|
cs.left = x + 'px'
|
||||||
cs.top = 'auto' if upwards else y + 'px'
|
cs.top = 'auto' if upwards else y + 'px'
|
||||||
cs.bottom = y + 'px' if upwards else 'auto'
|
cs.bottom = (window.innerHeight - y) + 'px' if upwards else 'auto'
|
||||||
cs.width = width + 'px'
|
cs.width = width + 'px'
|
||||||
cs.maxHeight = ((y if upwards else window.innerHeight - y) - 10) + 'px'
|
cs.maxHeight = ((y if upwards else window.innerHeight - y) - 10) + 'px'
|
||||||
show_popup(self.container_id, self.associated_widget_ids)
|
show_popup(self.container_id, self.associated_widget_ids)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user