Update JSON API
[src/app-framework-demo.git] / afm-client / bower_components / tether / coffee / shift.coffee
1 @Tether.modules.push
2   position: ({top, left}) ->
3     return unless @options.shift
4
5     result = (val) ->
6       if typeof val is 'function'
7         val.call @, {top, left}
8       else
9         val
10
11     shift = result @options.shift
12
13     if typeof shift is 'string'
14       shift = shift.split(' ')
15       shift[1] or= shift[0]
16
17       [shiftTop, shiftLeft] = shift
18
19       shiftTop = parseFloat shiftTop, 10
20       shiftLeft = parseFloat shiftLeft, 10
21     else
22       [shiftTop, shiftLeft] = [shift.top, shift.left]
23
24     top += shiftTop
25     left += shiftLeft
26
27     {top, left}