Files
pathfinder/js/app/map/scrollbar.js
Exodus4D ce0cbedc06 - fixed some "rubber banding" problems with system position (new "update queue" system for maps, JS)
- Decreased mapData cache 120s -> 60s
- Increased default "lifetime" for "private" maps 14d -> 30d
- UI tweaks for "connection <-> signature" linked labels, #290
- fixed some "drag&drop" problems with connections
- Updated "jQuery" 3.0.0 => 3.1.1
- PHP7.1 fixes (routes.ini), closed #410
- fixed a bug where "mapAccess" data is not properly send through webSocket
2017-02-25 16:18:24 +01:00

75 lines
2.1 KiB
JavaScript

/**
* Created by Exodus on 26.06.2016.
*/
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'use strict';
/**
* init map scrollbar
* @param config
* @returns {*}
*/
$.fn.initCustomScrollbar = function(config){
// default config -------------------------------------------------------------------------
let defaultConfig = {
axis: 'x',
theme: 'light-thick',
scrollInertia: 300,
autoExpandScrollbar: false,
scrollButtons:{
scrollAmount: 30,
enable: true
},
callbacks:{
onTotalScrollOffset: 0,
onTotalScrollBackOffset: 0,
alwaysTriggerOffsets: true
},
advanced: {
updateOnBrowserResize: true,
updateOnContentResize: true,
autoExpandHorizontalScroll: true,
autoScrollOnFocus: 'div'
},
mouseWheel:{
enable: false, // scroll weel currently disabled
scrollAmount: 'auto',
axis: 'x',
preventDefault: true
},
scrollbarPosition: 'inside',
autoDraggerLength: true
//autoHideScrollbar: false
};
// init -----------------------------------------------------------------------------------
config = $.extend(true, {}, defaultConfig, config);
return this.each(function(){
let scrollableElement = $(this);
// prevent multiple initialization
scrollableElement.mCustomScrollbar('destroy');
// init custom scrollbars
scrollableElement.mCustomScrollbar(config);
});
};
/**
* scroll to a specific position in the map
* demo: http://manos.malihu.gr/repository/custom-scrollbar/demo/examples/scrollTo_demo.html
* @returns {*} // string or id
*/
$.fn.scrollToX = function(position){
return this.each(function(){
$(this).mCustomScrollbar('scrollTo', position);
});
};
});