/**
* Styles scrollbars for all elements, and enabled 3-finger scrolling on the
* body element.
*
* @name Lens.LAF.Scrollbars
* @namespace
*/
define(["lib/jquery", "common/util/dom_utils", "Components/scrollable"],
function($, DOMUtils, Scrollable) {
"use strict";
var enabled = false;
var bodyScrollable = Scrollable($(window));
var Scrollbars = /** @lends Lens.LAF.Scrollbars */ {
/**
* Enables scrollbar styling and body scrollability
*/
enable: function() {
DOMUtils.addStylesheet("LAF/widgets/scrollbars.less");
if(enabled){
bodyScrollable.enable();
} else {
$(function(){ bodyScrollable.enable();} );
}
enabled = true;
},
/**
* Disables scrollbar styling and body scrollability
*/
disable: function() {
DOMUtils.removeStylesheet("LAF/widgets/scrollbars.less");
bodyScrollable.disable();
enabled = false;
},
/**
* Returns true iff this LAF module is enabled
* @return {Boolean}
* @memberOf Lens.LAF.Scrollbars
*/
enabled: function() {
return enabled;
},
/**
* Enables body scrollability
*/
enableBodyScroll: function() {
bodyScrollable.enable();
},
/**
* Disables body scrollability
*/
disableBodyScroll: function() {
bodyScrollable.disable();
},
onBodyScroll: function(callback){
bodyScrollable.onScroll(callback);
}
};
Scrollbars.enable();
Lens._addMember(Scrollbars, "Scrollbars", Lens.LAF);
return Scrollbars;
});