@ -90,7 +90,9 @@ Core.prototype._create = function (container) {
this . dom . rightContainer . appendChild ( this . dom . shadowTopRight ) ;
this . dom . rightContainer . appendChild ( this . dom . shadowTopRight ) ;
this . dom . rightContainer . appendChild ( this . dom . shadowBottomRight ) ;
this . dom . rightContainer . appendChild ( this . dom . shadowBottomRight ) ;
this . on ( 'rangechange' , this . redraw . bind ( this ) ) ;
this . on ( 'rangechange' , function ( ) {
this . redraw ( ) ; // this allows overriding the redraw method
} . bind ( this ) ) ;
this . on ( 'touch' , this . _onTouch . bind ( this ) ) ;
this . on ( 'touch' , this . _onTouch . bind ( this ) ) ;
this . on ( 'pan' , this . _onDrag . bind ( this ) ) ;
this . on ( 'pan' , this . _onDrag . bind ( this ) ) ;
@ -216,7 +218,8 @@ Core.prototype.setOptions = function (options) {
var fields = [
var fields = [
'width' , 'height' , 'minHeight' , 'maxHeight' , 'autoResize' ,
'width' , 'height' , 'minHeight' , 'maxHeight' , 'autoResize' ,
'start' , 'end' , 'clickToUse' , 'dataAttributes' , 'hiddenDates' ,
'start' , 'end' , 'clickToUse' , 'dataAttributes' , 'hiddenDates' ,
'locale' , 'locales' , 'moment'
'locale' , 'locales' , 'moment' ,
'throttleRedraw'
] ;
] ;
util . selectiveExtend ( fields , this . options , options ) ;
util . selectiveExtend ( fields , this . options , options ) ;
@ -311,6 +314,12 @@ Core.prototype.setOptions = function (options) {
this . configurator . setModuleOptions ( { global : appliedOptions } ) ;
this . configurator . setModuleOptions ( { global : appliedOptions } ) ;
}
}
// override redraw with a throttled version
if ( ! this . _origRedraw ) {
this . _origRedraw = this . redraw . bind ( this ) ;
}
this . redraw = util . throttle ( this . _origRedraw , this . options . throttleRedraw ) ;
// redraw everything
// redraw everything
this . _redraw ( ) ;
this . _redraw ( ) ;
} ;
} ;
@ -581,6 +590,8 @@ Core.prototype.getWindow = function() {
/ * *
/ * *
* Force a redraw . Can be overridden by implementations of Core
* Force a redraw . Can be overridden by implementations of Core
*
* Note : this function will be overridden on construction with a trottled version
* /
* /
Core . prototype . redraw = function ( ) {
Core . prototype . redraw = function ( ) {
this . _redraw ( ) ;
this . _redraw ( ) ;