X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=afm-client%2Fbower_components%2Ftether%2Fcoffee%2Fshift.coffee;fp=afm-client%2Fbower_components%2Ftether%2Fcoffee%2Fshift.coffee;h=4dede411d2f522ed8125924e8295463d61a5743c;hb=be83a8f382cf2fea98161bfd6d51719aacbf9aa9;hp=0000000000000000000000000000000000000000;hpb=1a4ed39bf86b2115eb0f1387d1e988462b492776;p=src%2Fapp-framework-demo.git diff --git a/afm-client/bower_components/tether/coffee/shift.coffee b/afm-client/bower_components/tether/coffee/shift.coffee new file mode 100644 index 0000000..4dede41 --- /dev/null +++ b/afm-client/bower_components/tether/coffee/shift.coffee @@ -0,0 +1,27 @@ +@Tether.modules.push + position: ({top, left}) -> + return unless @options.shift + + result = (val) -> + if typeof val is 'function' + val.call @, {top, left} + else + val + + shift = result @options.shift + + if typeof shift is 'string' + shift = shift.split(' ') + shift[1] or= shift[0] + + [shiftTop, shiftLeft] = shift + + shiftTop = parseFloat shiftTop, 10 + shiftLeft = parseFloat shiftLeft, 10 + else + [shiftTop, shiftLeft] = [shift.top, shift.left] + + top += shiftTop + left += shiftLeft + + {top, left}