Skip to content

Commit 7ae70d2

Browse files
committed
Merge branch 'kvindasAB-master'
2 parents 80e2c59 + ec8b49a commit 7ae70d2

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

rzslider.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ function throttle(func, wait, options) {
215215
});
216216

217217
// Recalculate slider view dimensions
218-
this.scope.$on('reCalcViewDimensions', angular.bind(this, this.calcViewDimensions));
218+
this.scope.$on('reCalcViewDimensions', angular.bind(this, this.resetSlider));
219219

220220
// Recalculate stuff if view port dimensions have changed
221-
angular.element(window).on('resize', angular.bind(this, this.calcViewDimensions));
221+
angular.element(window).on('resize', angular.bind(this, this.resetSlider));
222222

223223
this.initRun = true;
224224

@@ -256,8 +256,39 @@ function throttle(func, wait, options) {
256256
if(newValue === oldValue) return;
257257
thrHigh();
258258
});
259+
260+
261+
this.scope.$watch('rzSliderFloor', function(newValue, oldValue){
262+
if(newValue === oldValue) return;
263+
self.resetSlider();
264+
});
265+
266+
this.scope.$watch('rzSliderCeil', function(newValue, oldValue){
267+
if(newValue === oldValue) return;
268+
self.resetSlider();
269+
});
270+
271+
this.scope.$watch('rzSliderForceRender', function(newValue, oldValue){
272+
self.resetLabelsWidth();
273+
thrLow();
274+
thrHigh();
275+
self.resetSlider();
276+
});
277+
278+
},
279+
280+
resetSlider: function() {
281+
this.setMinAndMax();
282+
this.calcViewDimensions();
283+
this.updateCeilLab();
284+
this.updateFloorLab();
259285
},
260286

287+
resetLabelsWidth: function() {
288+
this.minLab.rzsv = undefined;
289+
this.maxLab.rzsv = undefined;
290+
},
291+
261292
/**
262293
* Initialize slider handles positions and labels
263294
*

0 commit comments

Comments
 (0)