Source: directive/scrollFloat.js

// Generated by CoffeeScript 1.12.7

/**
 * Fix the save/cancel buttons at the top on scroll
 * @module
 */
'use strict';
app.directive('scrollFloat', [
  '$window', 'constantService', function(window, constants) {
    return {
      restrict: 'E',
      transclude: true,
      templateUrl: 'directive/scrollFloat.html',
      link: function($scope, $element) {
        var floater, handler, scroll;
        floater = $element[0].firstChild;
        while (floater && floater.tagName !== 'DIV') {
          floater = floater.nextSibling;
        }
        scroll = function() {
          var box, skip;
          box = floater.getBoundingClientRect();
          skip = constants.sandbox ? 84 : 36;
          return $scope.scrollFloating = box.height && box.top < skip;
        };
        handler = $scope.$lift(scroll);
        window.addEventListener('scroll', handler);
        $scope.$on('$destroy', function() {
          return window.removeEventListener('scroll', handler);
        });
        scroll();
      }
    };
  }
]);

//# sourceMappingURL=scrollFloat.js.map