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;
|
border-bottom: 0;
|
||||||
display: -webkit-flex;
|
display: -webkit-flex;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin: 2px 0;
|
||||||
-webkit-flex-direction: column;
|
-webkit-flex-direction: column;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@ -67,19 +67,14 @@ UI = do ->
|
|||||||
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left
|
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left
|
||||||
cHeight = doc.clientHeight
|
cHeight = doc.clientHeight
|
||||||
cWidth = doc.clientWidth
|
cWidth = doc.clientWidth
|
||||||
if bRect.top + bRect.height + mRect.height < cHeight
|
[top, bottom] = if bRect.top + bRect.height + mRect.height < cHeight
|
||||||
# XXX calc(100% + 2px) would have been better, but >Presto.
|
['100%', null]
|
||||||
top = bRect.height + 2 + 'px'
|
|
||||||
bottom = 'auto'
|
|
||||||
else
|
else
|
||||||
top = 'auto'
|
[null, '100%']
|
||||||
bottom = bRect.height + 2 + 'px'
|
[left, right] = if bRect.left + mRect.width < cWidth
|
||||||
if bRect.left + mRect.width < cWidth
|
['0px', null]
|
||||||
left = '0px'
|
|
||||||
right = 'auto'
|
|
||||||
else
|
else
|
||||||
left = 'auto'
|
[null, '0px']
|
||||||
right = '0px'
|
|
||||||
{style} = menu
|
{style} = menu
|
||||||
style.top = top
|
style.top = top
|
||||||
style.right = right
|
style.right = right
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user