Commit 34d9c338 authored by Valentin Hervieu's avatar Valentin Hervieu

Fixes #94. It was because the click on the bar was not handled properly and the…

Fixes #94. It was because the click on the bar was not handled properly and the min and max handles were not switched when needed.
parent a5f14c33
/*! jusas-angularjs-slider - v0.1.22 - (c) Rafal Zajac <rzajac@gmail.com>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-07-22 */ /*! jusas-angularjs-slider - v0.1.22 - (c) Rafal Zajac <rzajac@gmail.com>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-07-28 */
rzslider{position:relative;display:inline-block;width:100%;height:4px;margin:30px 0 15px 0;vertical-align:middle}rzslider span{position:absolute;display:inline-block;white-space:nowrap}rzslider span.rz-base{width:100%;height:100%;padding:0}rzslider span.rz-bar-wrapper{width:100%;height:32px;padding-top:16px;margin-top:-16px;box-sizing:border-box}rzslider span.rz-bar{z-index:0;width:100%;height:4px;background:#d8e0f3;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}rzslider span.rz-bar.rz-selection{z-index:1;width:0;background:#0db9f0;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}rzslider span.rz-pointer{top:-14px;z-index:2;width:32px;height:32px;cursor:pointer;background-color:#0db9f0;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}rzslider span.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 span.rz-pointer:hover:after{background-color:#fff}rzslider span.rz-pointer.rz-active:after{background-color:#451aff}rzslider span.rz-bubble{top:-32px;padding:1px 3px;color:#55637d;cursor:default}rzslider span.rz-bubble.rz-selection{top:16px}rzslider span.rz-bubble.rz-limit{color:#55637d} rzslider{position:relative;display:inline-block;width:100%;height:4px;margin:30px 0 15px 0;vertical-align:middle}rzslider span{position:absolute;display:inline-block;white-space:nowrap}rzslider span.rz-base{width:100%;height:100%;padding:0}rzslider span.rz-bar-wrapper{width:100%;height:32px;padding-top:16px;margin-top:-16px;box-sizing:border-box}rzslider span.rz-bar{z-index:0;width:100%;height:4px;background:#d8e0f3;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}rzslider span.rz-bar.rz-selection{z-index:1;width:0;background:#0db9f0;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}rzslider span.rz-pointer{top:-14px;z-index:2;width:32px;height:32px;cursor:pointer;background-color:#0db9f0;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}rzslider span.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 span.rz-pointer:hover:after{background-color:#fff}rzslider span.rz-pointer.rz-active:after{background-color:#451aff}rzslider span.rz-bubble{top:-32px;padding:1px 3px;color:#55637d;cursor:default}rzslider span.rz-bubble.rz-selection{top:16px}rzslider span.rz-bubble.rz-limit{color:#55637d}
\ No newline at end of file
This diff is collapsed.
...@@ -472,7 +472,6 @@ function throttle(func, wait, options) { ...@@ -472,7 +472,6 @@ function throttle(func, wait, options) {
}, this); }, this);
// Initialize offset cache properties // Initialize offset cache properties
this.fullBar.rzsl = 0;
this.selBar.rzsl = 0; this.selBar.rzsl = 0;
this.minH.rzsl = 0; this.minH.rzsl = 0;
this.maxH.rzsl = 0; this.maxH.rzsl = 0;
...@@ -922,34 +921,38 @@ function throttle(func, wait, options) { ...@@ -922,34 +921,38 @@ function throttle(func, wait, options) {
if(newOffset <= 0) if(newOffset <= 0)
{ {
if(pointer.rzsl !== 0) if(pointer.rzsl === 0)
{ return;
this.scope[this.tracking] = this.minValue; newValue = this.minValue;
this.updateHandles(this.tracking, 0); newOffset = 0;
this.scope.$apply();
}
return;
} }
else if(newOffset >= this.maxLeft)
if(newOffset >= this.maxLeft)
{ {
if(pointer.rzsl !== this.maxLeft) if(pointer.rzsl === this.maxLeft)
{ return;
this.scope[this.tracking] = this.maxValue; newValue = this.maxValue;
this.updateHandles(this.tracking, this.maxLeft); newOffset = this.maxLeft;
this.scope.$apply(); }
} else {
newValue = this.offsetToValue(newOffset);
return; newValue = this.roundStep(newValue);
newOffset = this.valueToOffset(newValue);
} }
this.positionTrackingHandle(newValue, newOffset);
},
newValue = this.offsetToValue(newOffset);
newValue = this.roundStep(newValue);
newOffset = this.valueToOffset(newValue);
/**
* Set the new value and offset to the current tracking handle
*
* @param {number} newValue new model value
* @param {number} newOffset new offset value
*/
positionTrackingHandle: function(newValue, newOffset)
{
if (this.range) if (this.range)
{ {
/* This is to check if we need to switch the min and max handles*/
if (this.tracking === 'rzSliderModel' && newValue >= this.scope.rzSliderHigh) if (this.tracking === 'rzSliderModel' && newValue >= this.scope.rzSliderHigh)
{ {
this.scope[this.tracking] = this.scope.rzSliderHigh; this.scope[this.tracking] = this.scope.rzSliderHigh;
......
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