Better menu positioning code.
This commit is contained in:
parent
1cb7f9c6c1
commit
c8e2b23faf
File diff suppressed because one or more lines are too long
@ -734,6 +734,7 @@ a[href="javascript:;"] {
|
||||
border-bottom: 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
margin: 2px 0;
|
||||
-webkit-flex-direction: column;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
|
||||
@ -67,19 +67,14 @@ UI = do ->
|
||||
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left
|
||||
cHeight = doc.clientHeight
|
||||
cWidth = doc.clientWidth
|
||||
if bRect.top + bRect.height + mRect.height < cHeight
|
||||
# XXX calc(100% + 2px) would have been better, but >Presto.
|
||||
top = bRect.height + 2 + 'px'
|
||||
bottom = 'auto'
|
||||
[top, bottom] = if bRect.top + bRect.height + mRect.height < cHeight
|
||||
['100%', null]
|
||||
else
|
||||
top = 'auto'
|
||||
bottom = bRect.height + 2 + 'px'
|
||||
if bRect.left + mRect.width < cWidth
|
||||
left = '0px'
|
||||
right = 'auto'
|
||||
[null, '100%']
|
||||
[left, right] = if bRect.left + mRect.width < cWidth
|
||||
['0px', null]
|
||||
else
|
||||
left = 'auto'
|
||||
right = '0px'
|
||||
[null, '0px']
|
||||
{style} = menu
|
||||
style.top = top
|
||||
style.right = right
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user