Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 099b5f8

Browse files
committed
feat(style): Animate slider moves
Close #552
1 parent a44abcc commit 099b5f8

File tree

10 files changed

+99
-18
lines changed

10 files changed

+99
-18
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 7.0.0 (not-released-yet)
2+
3+
## Feature
4+
5+
- feat(transition): slider moves are now animated. (this can be disabled via the `disableAnimation` option)
6+
7+
## Breaking change
8+
9+
The module name was renamed from `rzModule` to `rzSlider`.
10+
111
# 6.7.0 (2019-02-23)
212

313
## Feature

demo/demo.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,6 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) {
464464
floor: 0,
465465
ceil: 10,
466466
vertical: true,
467-
showSelectionBarEnd: true,
468-
selectionBarGradient: {
469-
from: 'white',
470-
to: '#0db9f0',
471-
},
472467
},
473468
}
474469
$scope.verticalSlider2 = {
@@ -478,10 +473,6 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) {
478473
floor: 0,
479474
ceil: 100,
480475
vertical: true,
481-
selectionBarGradient: {
482-
from: 'white',
483-
to: '#0db9f0',
484-
},
485476
},
486477
}
487478
$scope.verticalSlider3 = {

dist/rzslider.css

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

dist/rzslider.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
enforceRange: false,
7373
noSwitching: false,
7474
onlyBindHandles: false,
75+
disableAnimation: false,
7576
onStart: null,
7677
onChange: null,
7778
onEnd: null,
@@ -332,6 +333,11 @@
332333
*/
333334
this.currentFocusElement = null
334335

336+
/**
337+
* Internal variable to know if we are already moving
338+
*/
339+
this.moving = false
340+
335341
// Slider DOM elements wrapped in jqLite
336342
this.fullBar = null // The whole slider bar
337343
this.selBar = null // Highlight between two handles
@@ -387,6 +393,10 @@
387393

388394
this.initHasRun = true
389395

396+
if (this.options.disableAnimation) {
397+
this.sliderElem.addClass('noanimate')
398+
}
399+
390400
// Watch for changes to the model
391401
thrLow = rzThrottle(function() {
392402
self.onLowHandleChange()
@@ -2036,6 +2046,12 @@
20362046
* @returns {undefined}
20372047
*/
20382048
onMove: function(pointer, event, fromTick) {
2049+
if (!this.options.disableAnimation) {
2050+
if (this.moving) {
2051+
this.sliderElem.addClass('noanimate')
2052+
}
2053+
}
2054+
this.moving = true
20392055
var changedTouches = this.getEventAttr(event, 'changedTouches')
20402056
var touchForThisSlider
20412057
if (changedTouches) {
@@ -2082,6 +2098,10 @@
20822098
* @returns {undefined}
20832099
*/
20842100
onEnd: function(ehMove, event) {
2101+
this.moving = false
2102+
if (!this.options.disableAnimation) {
2103+
this.sliderElem.removeClass('noanimate')
2104+
}
20852105
var changedTouches = this.getEventAttr(event, 'changedTouches')
20862106
if (changedTouches && changedTouches[0].identifier !== this.touchId) {
20872107
return
@@ -2328,6 +2348,12 @@
23282348
* @returns {undefined}
23292349
*/
23302350
onDragMove: function(pointer, event) {
2351+
if (!this.options.disableAnimation) {
2352+
if (this.moving) {
2353+
this.sliderElem.addClass('noanimate')
2354+
}
2355+
}
2356+
this.moving = true
23312357
var newPos = this.getEventPosition(event),
23322358
newMinValue,
23332359
newMaxValue,

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.

0 commit comments

Comments
 (0)