Merge branch 'master' into catalog

This commit is contained in:
ccd0 2014-09-16 18:24:36 -07:00
commit 8a29978882

View File

@ -307,8 +307,10 @@ UI = do ->
root root
el el
style: el.style style: el.style
isImage: el.nodeName in ['IMG', 'VIDEO']
cb cb
endEvents endEvents
ready: false
latestEvent latestEvent
clientHeight: doc.clientHeight clientHeight: doc.clientHeight
clientWidth: doc.clientWidth clientWidth: doc.clientWidth
@ -320,6 +322,7 @@ UI = do ->
$.asap -> $.asap ->
!el.parentNode or asapTest() !el.parentNode or asapTest()
, -> , ->
o.ready = true
o.hover o.latestEvent if el.parentNode o.hover o.latestEvent if el.parentNode
$.on root, endEvents, o.hoverend $.on root, endEvents, o.hoverend
@ -334,18 +337,18 @@ UI = do ->
hover = (e) -> hover = (e) ->
@latestEvent = e @latestEvent = e
return unless @ready
height = @el.offsetHeight height = @el.offsetHeight
{clientX, clientY} = e {clientX, clientY} = e
top = clientY - 120 top = if @isImage
top = if @clientHeight <= height or top <= 0 Math.max 0, clientY * (@clientHeight - height) / @clientHeight
0
else if top + height >= @clientHeight
@clientHeight - height
else else
top Math.max 0, Math.min(@clientHeight - height, clientY - 120)
[left, right] = if clientX <= @clientWidth / 2 threshold = @clientWidth / 2
threshold = Math.max threshold, @clientWidth - 400 unless @isImage
[left, right] = if clientX <= threshold
[clientX + 45 + 'px', null] [clientX + 45 + 'px', null]
else else
[null, @clientWidth - clientX + 45 + 'px'] [null, @clientWidth - clientX + 45 + 'px']