1 {getBounds, updateClasses, defer} = @Tether.Utils
4 position: ({top, left}) ->
5 {height, width} = @cache 'element-bounds', => getBounds @element
7 targetPos = @getTargetBounds()
13 if top <= targetPos.bottom and bottom >= targetPos.top
14 for side in ['left', 'right']
15 if targetPos[side] in [left, right]
18 if left <= targetPos.right and right >= targetPos.left
19 for side in ['top', 'bottom']
20 if targetPos[side] in [top, bottom]
26 sides = ['left', 'top', 'right', 'bottom']
27 allClasses.push @getClass('abutted')
29 allClasses.push "#{ @getClass('abutted') }-#{ side }"
32 addClasses.push @getClass('abutted')
34 addClasses.push "#{ @getClass('abutted') }-#{ side }"
37 updateClasses @target, addClasses, allClasses
38 updateClasses @element, addClasses, allClasses