Commit 7d09446a authored by Valentin Hervieu's avatar Valentin Hervieu

6.2.0 release

parent 9bca8ac9
{
"name": "angularjs-slider",
"version": "6.1.2",
"version": "6.2.0",
"homepage": "https://github.com/angular-slider/angularjs-slider",
"authors": [
"Rafal Zajac <rzajac@gmail.com>",
......
This diff is collapsed.
/*! angularjs-slider - v6.1.2 -
/*! angularjs-slider - v6.2.0 -
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
https://github.com/angular-slider/angularjs-slider -
2017-05-25 */
......@@ -158,7 +158,7 @@
.factory('RzSlider', ['$timeout', '$document', '$window', '$compile', 'RzSliderOptions', 'rzThrottle', function($timeout, $document, $window, $compile, RzSliderOptions, rzThrottle) {
'use strict';
/**
* Slider
*
......@@ -458,7 +458,7 @@
}
return index;
},
syncLowValue: function() {
if (this.options.stepsArray) {
if (!this.options.bindIndexForStepsArray)
......@@ -1183,7 +1183,7 @@
isMinLabAtCeil = this.isLabelAboveCeilLab(this.minLab),
isMaxLabAtCeil = this.isLabelAboveCeilLab(this.maxLab),
isCmbLabAtFloor = this.isLabelBelowFloorLab(this.cmbLab),
isCmbLabAtCeil = this.isLabelAboveCeilLab(this.cmbLab);
isCmbLabAtCeil = this.isLabelAboveCeilLab(this.cmbLab);
if (isMinLabAtFloor) {
flHidden = true;
......@@ -1227,8 +1227,8 @@
floorPos = this.flrLab.rzsp,
floorDim = this.flrLab.rzsd;
return isRTL ?
pos + dim >= floorPos - 2 :
pos <= floorPos + floorDim + 2;
pos + dim >= floorPos - 2 :
pos <= floorPos + floorDim + 2;
},
isLabelAboveCeilLab: function(label) {
......@@ -1238,8 +1238,8 @@
ceilPos = this.ceilLab.rzsp,
ceilDim = this.ceilLab.rzsd;
return isRTL ?
pos <= ceilPos + ceilDim + 2 :
pos + dim >= ceilPos - 2;
pos <= ceilPos + ceilDim + 2 :
pos + dim >= ceilPos - 2;
},
/**
......@@ -1555,12 +1555,16 @@
return Math.exp(value);
},
getEventAttr: function(event, attr) {
return event.originalEvent === undefined ? event[attr] : event.originalEvent[attr]
},
// Events
/**
* Get the X-coordinate or Y-coordinate of an event
*
* @param {Object} event The event
* @param targetTouchId The identifier of the touch for that we will get the x and y coordinates
* @param targetTouchId The identifier of the touch with the X/Y coordinates
* @returns {number}
*/
getEventXY: function(event, targetTouchId) {
......@@ -1570,27 +1574,26 @@
if (event[clientXY] !== undefined) {
return event[clientXY];
}
var eventXY;
var touches = event.originalEvent === undefined ? event.touches : event.originalEvent.touches;
if (targetTouchId !== undefined) {
for (var i = 0; i < touches.length; i++) {
if (touches[i].identifier == targetTouchId) {
return touches[i][clientXY];
}
}
}
// If the target touch was not found in the event
// returns the coordinates of the first touch
return touches[0][clientXY];
var touches = this.getEventAttr(event, 'touches');
if (targetTouchId !== undefined) {
for (var i = 0; i < touches.length; i++) {
if (touches[i].identifier === targetTouchId) {
return touches[i][clientXY];
}
}
}
// If no target touch or the target touch was not found in the event
// returns the coordinates of the first touch
return touches[0][clientXY];
},
/**
* Compute the event position depending on whether the slider is horizontal or vertical
* @param event
* @param targetTouchId If targetTouchId is provided it will be considered the position of that
* @param targetTouchId If targetTouchId is provided it will be considered the position of that
* @returns {number}
*/
getEventPosition: function(event, targetTouchId) {
......@@ -1616,7 +1619,7 @@
endEvent: ''
};
if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) {
if (this.getEventAttr(event, 'touches')) {
eventNames.moveEvent = 'touchmove';
eventNames.endEvent = 'touchend';
} else {
......@@ -1777,19 +1780,19 @@
ehEnd = angular.bind(this, this.onEnd, ehMove);
$document.on(eventNames.moveEvent, ehMove);
$document.on(eventNames.endEvent, ehEnd);
this.ehEndToBeRemovedOnEnd = ehEnd;
this.callOnStart();
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches) {
// Store the touch identifier
if (!this.touchId) {
this.isDragging = true;
this.touchId = changedTouches[0].identifier;
}
}
// Store the touch identifier
if (!this.touchId) {
this.isDragging = true;
this.touchId = changedTouches[0].identifier;
}
}
},
/**
......@@ -1801,21 +1804,21 @@
* @returns {undefined}
*/
onMove: function(pointer, event, fromTick) {
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
var touchForThisSlider;
if (changedTouches) {
for (var i = 0; i < changedTouches.length; i++) {
if (changedTouches[i].identifier == this.touchId) {
touchForThisSlider = changedTouches[i];
break;
}
}
}
if (changedTouches && !touchForThisSlider) {
return;
}
var changedTouches = this.getEventAttr(event, 'changedTouches');
var touchForThisSlider;
if (changedTouches) {
for (var i = 0; i < changedTouches.length; i++) {
if (changedTouches[i].identifier === this.touchId) {
touchForThisSlider = changedTouches[i];
break;
}
}
}
if (changedTouches && !touchForThisSlider) {
return;
}
var newPos = this.getEventPosition(event, touchForThisSlider ? touchForThisSlider.identifier : undefined),
newValue,
ceilValue = this.options.rightToLeft ? this.minValue : this.maxValue,
......@@ -1834,7 +1837,7 @@
}
this.positionTrackingHandle(newValue);
},
/**
* onEnd event handler
*
......@@ -1843,16 +1846,16 @@
* @returns {undefined}
*/
onEnd: function(ehMove, event) {
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
if (changedTouches && changedTouches[0].identifier != this.touchId) {
return;
}
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches && changedTouches[0].identifier !== this.touchId) {
return;
}
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var moveEventName = this.getEventNames(event).moveEvent;
if (!this.options.keyboardSupport) {
......@@ -1894,8 +1897,8 @@
pointer.off('keyup');
pointer.removeClass('rz-active');
if (!this.isDragging) {
this.tracking = '';
this.currentFocusElement = null
this.tracking = '';
this.currentFocusElement = null
}
},
......
/*! angularjs-slider - v6.1.2 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> - https://github.com/angular-slider/angularjs-slider - 2017-05-25 */
/*! angularjs-slider - v6.2.0 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> - https://github.com/angular-slider/angularjs-slider - 2017-05-25 */
.rzslider{position:relative;display:inline-block;width:100%;height:4px;margin:35px 0 15px 0;vertical-align:middle;user-select:none}.rzslider.with-legend{margin-bottom:40px}.rzslider[disabled]{cursor:not-allowed}.rzslider[disabled] .rz-pointer{cursor:not-allowed;background-color:#d8e0f3}.rzslider[disabled] .rz-draggable{cursor:not-allowed}.rzslider[disabled] .rz-selection{background:#8b91a2}.rzslider[disabled] .rz-tick{cursor:not-allowed}.rzslider[disabled] .rz-tick.rz-selected{background:#8b91a2}.rzslider span{position:absolute;display:inline-block;white-space:nowrap}.rzslider .rz-base{width:100%;height:100%;padding:0}.rzslider .rz-bar-wrapper{left:0;z-index:1;width:100%;height:32px;padding-top:16px;margin-top:-16px;box-sizing:border-box}.rzslider .rz-draggable{cursor:move}.rzslider .rz-bar{left:0;z-index:1;width:100%;height:4px;background:#d8e0f3;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-selection{z-index:2;background:#0db9f0;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-pointer{top:-14px;z-index:3;width:32px;height:32px;cursor:pointer;background-color:#0db9f0;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.rzslider .rz-pointer:after{position:absolute;top:12px;left:12px;width:8px;height:8px;background:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;content:''}.rzslider .rz-pointer:hover:after{background-color:#fff}.rzslider .rz-pointer.rz-active{z-index:4}.rzslider .rz-pointer.rz-active:after{background-color:#451aff}.rzslider .rz-bubble{bottom:16px;padding:1px 3px;color:#55637d;cursor:default}.rzslider .rz-bubble.rz-limit{color:#55637d}.rzslider .rz-ticks{position:absolute;top:-3px;left:0;z-index:1;width:100%;height:0;margin:0;list-style:none;box-sizing:border-box}.rzslider .rz-ticks-values-under .rz-tick-value{top:auto;bottom:-32px}.rzslider .rz-tick{position:absolute;top:0;left:0;width:10px;height:10px;margin-left:11px;text-align:center;cursor:pointer;background:#d8e0f3;border-radius:50%}.rzslider .rz-tick.rz-selected{background:#0db9f0}.rzslider .rz-tick-value{position:absolute;top:-30px;transform:translate(-50%,0)}.rzslider .rz-tick-legend{position:absolute;top:24px;max-width:50px;white-space:normal;transform:translate(-50%,0)}.rzslider.rz-vertical{position:relative;width:4px;height:100%;padding:0;margin:0 20px;vertical-align:baseline}.rzslider.rz-vertical .rz-base{width:100%;height:100%;padding:0}.rzslider.rz-vertical .rz-bar-wrapper{top:auto;left:0;width:32px;height:100%;padding:0 0 0 16px;margin:0 0 0 -16px}.rzslider.rz-vertical .rz-bar{bottom:0;left:auto;width:4px;height:100%}.rzslider.rz-vertical .rz-pointer{top:auto;bottom:0;left:-14px!important}.rzslider.rz-vertical .rz-bubble{bottom:0;left:16px!important;margin-left:3px}.rzslider.rz-vertical .rz-ticks{top:0;left:-3px;z-index:1;width:0;height:100%}.rzslider.rz-vertical .rz-tick{margin-top:11px;margin-left:auto;vertical-align:middle}.rzslider.rz-vertical .rz-tick-value{top:auto;left:24px;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-tick-legend{top:auto;right:24px;max-width:none;white-space:nowrap;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-ticks-values-under .rz-tick-value{right:24px;bottom:auto;left:auto}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
{
"name": "angularjs-slider",
"version": "6.1.2",
"version": "6.2.0",
"description": "AngularJS slider directive with no external dependencies. Mobile friendly!.",
"main": "dist/rzslider.js",
"repository": {
......
......@@ -162,7 +162,7 @@
.factory('RzSlider', function($timeout, $document, $window, $compile, RzSliderOptions, rzThrottle) {
'use strict';
/**
* Slider
*
......@@ -462,7 +462,7 @@
}
return index;
},
syncLowValue: function() {
if (this.options.stepsArray) {
if (!this.options.bindIndexForStepsArray)
......@@ -1187,7 +1187,7 @@
isMinLabAtCeil = this.isLabelAboveCeilLab(this.minLab),
isMaxLabAtCeil = this.isLabelAboveCeilLab(this.maxLab),
isCmbLabAtFloor = this.isLabelBelowFloorLab(this.cmbLab),
isCmbLabAtCeil = this.isLabelAboveCeilLab(this.cmbLab);
isCmbLabAtCeil = this.isLabelAboveCeilLab(this.cmbLab);
if (isMinLabAtFloor) {
flHidden = true;
......@@ -1231,8 +1231,8 @@
floorPos = this.flrLab.rzsp,
floorDim = this.flrLab.rzsd;
return isRTL ?
pos + dim >= floorPos - 2 :
pos <= floorPos + floorDim + 2;
pos + dim >= floorPos - 2 :
pos <= floorPos + floorDim + 2;
},
isLabelAboveCeilLab: function(label) {
......@@ -1242,8 +1242,8 @@
ceilPos = this.ceilLab.rzsp,
ceilDim = this.ceilLab.rzsd;
return isRTL ?
pos <= ceilPos + ceilDim + 2 :
pos + dim >= ceilPos - 2;
pos <= ceilPos + ceilDim + 2 :
pos + dim >= ceilPos - 2;
},
/**
......@@ -1559,6 +1559,10 @@
return Math.exp(value);
},
getEventAttr: function(event, attr) {
return event.originalEvent === undefined ? event[attr] : event.originalEvent[attr]
},
// Events
/**
* Get the X-coordinate or Y-coordinate of an event
......@@ -1574,27 +1578,26 @@
if (event[clientXY] !== undefined) {
return event[clientXY];
}
var eventXY;
var touches = event.originalEvent === undefined ? event.touches : event.originalEvent.touches;
if (targetTouchId !== undefined) {
for (var i = 0; i < touches.length; i++) {
if (touches[i].identifier == targetTouchId) {
return touches[i][clientXY];
}
}
}
// If no target touch or the target touch was not found in the event
// returns the coordinates of the first touch
return touches[0][clientXY];
var touches = this.getEventAttr(event, 'touches');
if (targetTouchId !== undefined) {
for (var i = 0; i < touches.length; i++) {
if (touches[i].identifier === targetTouchId) {
return touches[i][clientXY];
}
}
}
// If no target touch or the target touch was not found in the event
// returns the coordinates of the first touch
return touches[0][clientXY];
},
/**
* Compute the event position depending on whether the slider is horizontal or vertical
* @param event
* @param targetTouchId If targetTouchId is provided it will be considered the position of that
* @param targetTouchId If targetTouchId is provided it will be considered the position of that
* @returns {number}
*/
getEventPosition: function(event, targetTouchId) {
......@@ -1620,7 +1623,7 @@
endEvent: ''
};
if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) {
if (this.getEventAttr(event, 'touches')) {
eventNames.moveEvent = 'touchmove';
eventNames.endEvent = 'touchend';
} else {
......@@ -1781,19 +1784,19 @@
ehEnd = angular.bind(this, this.onEnd, ehMove);
$document.on(eventNames.moveEvent, ehMove);
$document.on(eventNames.endEvent, ehEnd);
this.ehEndToBeRemovedOnEnd = ehEnd;
this.callOnStart();
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches) {
// Store the touch identifier
if (!this.touchId) {
this.isDragging = true;
this.touchId = changedTouches[0].identifier;
}
}
// Store the touch identifier
if (!this.touchId) {
this.isDragging = true;
this.touchId = changedTouches[0].identifier;
}
}
},
/**
......@@ -1805,21 +1808,21 @@
* @returns {undefined}
*/
onMove: function(pointer, event, fromTick) {
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
var touchForThisSlider;
if (changedTouches) {
for (var i = 0; i < changedTouches.length; i++) {
if (changedTouches[i].identifier == this.touchId) {
touchForThisSlider = changedTouches[i];
break;
}
}
}
if (changedTouches && !touchForThisSlider) {
return;
}
var changedTouches = this.getEventAttr(event, 'changedTouches');
var touchForThisSlider;
if (changedTouches) {
for (var i = 0; i < changedTouches.length; i++) {
if (changedTouches[i].identifier === this.touchId) {
touchForThisSlider = changedTouches[i];
break;
}
}
}
if (changedTouches && !touchForThisSlider) {
return;
}
var newPos = this.getEventPosition(event, touchForThisSlider ? touchForThisSlider.identifier : undefined),
newValue,
ceilValue = this.options.rightToLeft ? this.minValue : this.maxValue,
......@@ -1838,7 +1841,7 @@
}
this.positionTrackingHandle(newValue);
},
/**
* onEnd event handler
*
......@@ -1847,16 +1850,16 @@
* @returns {undefined}
*/
onEnd: function(ehMove, event) {
var changedTouches = event.originalEvent === undefined ? event.changedTouches : event.originalEvent.changedTouches;
if (changedTouches && changedTouches[0].identifier != this.touchId) {
return;
}
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var changedTouches = this.getEventAttr(event, 'changedTouches');
if (changedTouches && changedTouches[0].identifier !== this.touchId) {
return;
}
this.isDragging = false;
this.touchId = null;
// Touch event, the listener was added by us so we need to remove it
$document.off("touchend", this.ehEndToBeRemovedOnEnd);
var moveEventName = this.getEventNames(event).moveEvent;
if (!this.options.keyboardSupport) {
......@@ -1898,8 +1901,8 @@
pointer.off('keyup');
pointer.removeClass('rz-active');
if (!this.isDragging) {
this.tracking = '';
this.currentFocusElement = null
this.tracking = '';
this.currentFocusElement = null
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment