|
1 | 1 | /*! angularjs-slider - v2.3.0 -
|
2 | 2 | (c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
|
3 | 3 | https://github.com/angular-slider/angularjs-slider -
|
4 |
| - 2015-12-23 */ |
| 4 | + 2015-12-24 */ |
5 | 5 | /*jslint unparam: true */
|
6 | 6 | /*global angular: false, console: false, define, module */
|
7 | 7 | (function(root, factory) {
|
|
278 | 278 | */
|
279 | 279 | init: function() {
|
280 | 280 | var thrLow, thrHigh,
|
281 |
| - calcDimFn = angular.bind(this, this.calcViewDimensions), |
282 | 281 | self = this;
|
283 | 282 |
|
| 283 | + var calcDimFn = function() { |
| 284 | + self.calcViewDimensions(); |
| 285 | + }; |
| 286 | + |
284 | 287 | this.applyOptions();
|
285 | 288 | this.initElemHandles();
|
286 | 289 | this.manageElementsStyle();
|
|
305 | 308 | this.initHasRun = true;
|
306 | 309 |
|
307 | 310 | // Watch for changes to the model
|
308 |
| - |
309 | 311 | thrLow = rzThrottle(function() {
|
310 |
| - self.setMinAndMax(); |
311 |
| - self.updateLowHandle(self.valueToOffset(self.scope.rzSliderModel)); |
312 |
| - self.updateSelectionBar(); |
313 |
| - self.updateTicksScale(); |
314 |
| - self.updateAriaAttributes(); |
315 |
| - |
316 |
| - if (self.range) { |
317 |
| - self.updateCmbLabel(); |
318 |
| - } |
319 |
| - |
| 312 | + self.onLowHandleChange(); |
320 | 313 | }, self.options.interval);
|
321 | 314 |
|
322 | 315 | thrHigh = rzThrottle(function() {
|
323 |
| - self.setMinAndMax(); |
324 |
| - self.updateHighHandle(self.valueToOffset(self.scope.rzSliderHigh)); |
325 |
| - self.updateSelectionBar(); |
326 |
| - self.updateTicksScale(); |
327 |
| - self.updateCmbLabel(); |
328 |
| - self.updateAriaAttributes(); |
| 316 | + self.onHighHandleChange(); |
329 | 317 | }, self.options.interval);
|
330 | 318 |
|
331 | 319 | this.scope.$on('rzSliderForceRender', function() {
|
|
373 | 361 | });
|
374 | 362 | },
|
375 | 363 |
|
| 364 | + /* |
| 365 | + * Reflow the slider when the low handle changes (called with throttle) |
| 366 | + */ |
| 367 | + onLowHandleChange: function() { |
| 368 | + this.setMinAndMax(); |
| 369 | + this.updateLowHandle(this.valueToOffset(this.scope.rzSliderModel)); |
| 370 | + this.updateSelectionBar(); |
| 371 | + this.updateTicksScale(); |
| 372 | + this.updateAriaAttributes(); |
| 373 | + if (this.range) { |
| 374 | + this.updateCmbLabel(); |
| 375 | + } |
| 376 | + }, |
| 377 | + |
| 378 | + /* |
| 379 | + * Reflow the slider when the high handle changes (called with throttle) |
| 380 | + */ |
| 381 | + onHighHandleChange: function() { |
| 382 | + this.setMinAndMax(); |
| 383 | + this.updateHighHandle(this.valueToOffset(this.scope.rzSliderHigh)); |
| 384 | + this.updateSelectionBar(); |
| 385 | + this.updateTicksScale(); |
| 386 | + this.updateCmbLabel(); |
| 387 | + this.updateAriaAttributes(); |
| 388 | + }, |
| 389 | + |
376 | 390 | /**
|
377 | 391 | * Read the user options and apply them to the slider model
|
378 | 392 | */
|
|
1638 | 1652 | 'use strict';
|
1639 | 1653 |
|
1640 | 1654 | $templateCache.put('rzSliderTpl.html',
|
1641 |
| - "<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=\"rz-bar rz-selection\" ng-style=barStyle></span></span> <span class=rz-pointer></span> <span class=rz-pointer></span> <span class=\"rz-bubble rz-limit\"></span> <span class=\"rz-bubble rz-limit\"></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul ng-show=showTicks class=rz-ticks><li ng-repeat=\"t in ticks track by $index\" class=tick ng-class=\"{selected: t.selected}\" ng-style=t.style ng-attr-uib-tooltip=\"{{ t.tooltip }}\" ng-attr-tooltip-placement={{t.tooltipPlacement}}><span ng-if=\"t.value != null\" class=tick-value ng-attr-uib-tooltip=\"{{ t.valueTooltip }}\" ng-attr-tooltip-placement={{t.valueTooltipPlacement}}>{{ t.value }}</span></li></ul>" |
| 1655 | + "<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=\"rz-bar rz-selection\" ng-style=barStyle></span></span> <span class=rz-pointer></span> <span class=rz-pointer></span> <span class=\"rz-bubble rz-limit\"></span> <span class=\"rz-bubble rz-limit\"></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul ng-show=showTicks class=rz-ticks><li ng-repeat=\"t in ticks track by $index\" class=tick ng-class=\"{selected: t.selected}\" ng-style=t.style ng-attr-uib-tooltip=\"{{ t.tooltip }}\" ng-attr-tooltip-placement={{t.tooltipPlacement}} ng-attr-tooltip-append-to-body=\"{{ t.tooltip ? true : undefined}}\"><span ng-if=\"t.value != null\" class=tick-value ng-attr-uib-tooltip=\"{{ t.valueTooltip }}\" ng-attr-tooltip-placement={{t.valueTooltipPlacement}}>{{ t.value }}</span></li></ul>" |
1642 | 1656 | );
|
1643 | 1657 |
|
1644 | 1658 | }]);
|
|
0 commit comments