Skip to content

Commit 20a6461

Browse files
committed
fix(change in function applyPushRange()): Apply the pushRange when the difference is greater than th
Apply the pushRange when the difference is greater than the maxRange set Close issue angular-slider#453
1 parent 8c85dcf commit 20a6461

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

dist/rzslider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.5 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-11-05 */
4+
2016-11-08 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.5 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-11-05 */
4+
2016-11-08 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -2141,17 +2141,33 @@
21412141

21422142
applyPushRange: function(newValue) {
21432143
var difference = this.tracking === 'lowValue' ? this.highValue - newValue : newValue - this.lowValue,
2144-
range = this.options.minRange !== null ? this.options.minRange : this.options.step;
2145-
if (difference < range) {
2144+
minRange = this.options.minRange !== null ? this.options.minRange : this.options.step,
2145+
maxRange = this.options.maxRange;
2146+
// if smaller than minRange
2147+
if (difference < minRange) {
21462148
if (this.tracking === 'lowValue') {
2147-
this.highValue = Math.min(newValue + range, this.maxValue);
2148-
newValue = this.highValue - range;
2149+
this.highValue = Math.min(newValue + minRange, this.maxValue);
2150+
newValue = this.highValue - minRange;
21492151
this.applyHighValue();
21502152
this.updateHandles('highValue', this.valueToPosition(this.highValue));
21512153
}
21522154
else {
2153-
this.lowValue = Math.max(newValue - range, this.minValue);
2154-
newValue = this.lowValue + range;
2155+
this.lowValue = Math.max(newValue - minRange, this.minValue);
2156+
newValue = this.lowValue + minRange;
2157+
this.applyLowValue();
2158+
this.updateHandles('lowValue', this.valueToPosition(this.lowValue));
2159+
}
2160+
this.updateAriaAttributes();
2161+
}
2162+
// if greater than maxRange
2163+
else if (maxRange !== null && difference > maxRange) {
2164+
if (this.tracking === 'lowValue') {
2165+
this.highValue = newValue + maxRange;
2166+
this.applyHighValue();
2167+
this.updateHandles('highValue', this.valueToPosition(this.highValue));
2168+
}
2169+
else {
2170+
this.lowValue = newValue - maxRange;
21552171
this.applyLowValue();
21562172
this.updateHandles('lowValue', this.valueToPosition(this.lowValue));
21572173
}

dist/rzslider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.5 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-11-05 */
4+
2016-11-08 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

0 commit comments

Comments
 (0)