Skip to content

Commit 9553442

Browse files
committed
Handle vertical + reverse case
1 parent 9897126 commit 9553442

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

demo/demo.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) {
426426
options: {
427427
floor: 0,
428428
ceil: 10,
429-
vertical: true
429+
vertical: true,
430+
showSelectionBarEnd: true,
431+
selectionBarGradient: {
432+
from: 'white',
433+
to: '#0db9f0'
434+
}
430435
}
431436
};
432437
$scope.verticalSlider2 = {

dist/rzslider.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.7 -
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-12-07 */
4+
2016-12-08 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.7 -
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-12-07 */
4+
2016-12-08 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -1272,12 +1272,12 @@
12721272
} else if (this.options.selectionBarGradient) {
12731273
var offset = this.options.showSelectionBarFromValue !== null ? this.valueToPosition(this.options.showSelectionBarFromValue) : 0,
12741274
reversed = offset - position > 0 ^ isSelectionBarFromRight,
1275-
direction = this.options.vertical ? 'top' : (reversed ? 'left' : 'right');
1275+
direction = this.options.vertical ? (reversed ? 'bottom' : 'top') : (reversed ? 'left' : 'right');
12761276
this.scope.barStyle = {
12771277
backgroundImage: 'linear-gradient(to ' + direction + ', ' + this.options.selectionBarGradient.from + ' 0%,' + this.options.selectionBarGradient.to + ' 100%)'
12781278
};
12791279
if (this.options.vertical) {
1280-
this.scope.barStyle.backgroundPosition = 'center ' + (offset + dimension + position + (reversed ? this.handleHalfDim : 0)) + 'px';
1280+
this.scope.barStyle.backgroundPosition = 'center ' + (offset + dimension + position + (reversed ? -this.handleHalfDim : 0)) + 'px';
12811281
this.scope.barStyle.backgroundSize = '100% ' + (this.barDimension - this.handleHalfDim) + 'px';
12821282
} else {
12831283
this.scope.barStyle.backgroundPosition = (offset - position + (reversed ? this.handleHalfDim : 0)) + 'px center';

dist/rzslider.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.8.7 -
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-12-07 */
4+
2016-12-08 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

src/rzslider.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1276,12 +1276,12 @@
12761276
} else if (this.options.selectionBarGradient) {
12771277
var offset = this.options.showSelectionBarFromValue !== null ? this.valueToPosition(this.options.showSelectionBarFromValue) : 0,
12781278
reversed = offset - position > 0 ^ isSelectionBarFromRight,
1279-
direction = this.options.vertical ? 'top' : (reversed ? 'left' : 'right');
1279+
direction = this.options.vertical ? (reversed ? 'bottom' : 'top') : (reversed ? 'left' : 'right');
12801280
this.scope.barStyle = {
12811281
backgroundImage: 'linear-gradient(to ' + direction + ', ' + this.options.selectionBarGradient.from + ' 0%,' + this.options.selectionBarGradient.to + ' 100%)'
12821282
};
12831283
if (this.options.vertical) {
1284-
this.scope.barStyle.backgroundPosition = 'center ' + (offset + dimension + position + (reversed ? this.handleHalfDim : 0)) + 'px';
1284+
this.scope.barStyle.backgroundPosition = 'center ' + (offset + dimension + position + (reversed ? -this.handleHalfDim : 0)) + 'px';
12851285
this.scope.barStyle.backgroundSize = '100% ' + (this.barDimension - this.handleHalfDim) + 'px';
12861286
} else {
12871287
this.scope.barStyle.backgroundPosition = (offset - position + (reversed ? this.handleHalfDim : 0)) + 'px center';

0 commit comments

Comments
 (0)