Commit 0fa7b2a0 authored by Rafal Zajac's avatar Rafal Zajac

Update to latest version

parent 719e2165
...@@ -4,3 +4,4 @@ header { background: #0db9f0; color: #fff; margin: -40px; margin-bottom: 40px; t ...@@ -4,3 +4,4 @@ header { background: #0db9f0; color: #fff; margin: -40px; margin-bottom: 40px; t
h1 { font-weight: 300; } h1 { font-weight: 300; }
.wrapper { background: #fff; padding: 40px; } .wrapper { background: #fff; padding: 40px; }
article { margin-bottom: 40px; } article { margin-bottom: 40px; }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</article> </article>
<article> <article>
<h2>One value slider example</h2> <h2>Currency slider example</h2>
Value: {{ priceSlider2 | json }} Value: {{ priceSlider2 | json }}
<rzslider <rzslider
...@@ -44,12 +44,13 @@ ...@@ -44,12 +44,13 @@
</article> </article>
<article> <article>
<h2>Currency slider example</h2> <h2>One value slider example</h2>
Value: {{ priceSlider2 | json }} Value: {{ priceSlider3 | json }}
<rzslider rz-slider-model="priceSlider3" <rzslider rz-slider-model="priceSlider3"
rz-slider-floor="50" rz-slider-floor="50"
rz-slider-ceil="450"></rzslider> rz-slider-ceil="450"
rz-slider-always-show-bar="true"></rzslider>
</article> </article>
<article> <article>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (c) Rafal Zajac <rzajac@gmail.com> * (c) Rafal Zajac <rzajac@gmail.com>
* http://github.com/rzajac/angularjs-slider * http://github.com/rzajac/angularjs-slider
* *
* Version: v0.1.11 * Version: v0.1.12
* *
* Licensed under the MIT license * Licensed under the MIT license
*/ */
...@@ -31,7 +31,7 @@ function throttle(func, wait, options) { ...@@ -31,7 +31,7 @@ function throttle(func, wait, options) {
var context, args, result; var context, args, result;
var timeout = null; var timeout = null;
var previous = 0; var previous = 0;
options || (options = {}); options = options || {};
var later = function() { var later = function() {
previous = options.leading === false ? 0 : getTime(); previous = options.leading === false ? 0 : getTime();
timeout = null; timeout = null;
...@@ -104,6 +104,13 @@ function throttle(func, wait, options) { ...@@ -104,6 +104,13 @@ function throttle(func, wait, options) {
*/ */
this.handleHalfWidth = 0; this.handleHalfWidth = 0;
/**
* Always show selection bar
*
* @type {string|boolean}
*/
this.alwaysShowBar = attributes.rzSliderAlwaysShowBar || false;
/** /**
* Maximum left the slider handle can have * Maximum left the slider handle can have
* *
...@@ -237,10 +244,10 @@ function throttle(func, wait, options) { ...@@ -237,10 +244,10 @@ function throttle(func, wait, options) {
{ {
self.setMinAndMax(); self.setMinAndMax();
self.updateLowHandle(self.valueToOffset(self.scope.rzSliderModel)); self.updateLowHandle(self.valueToOffset(self.scope.rzSliderModel));
self.updateSelectionBar();
if(self.range) if(self.range)
{ {
self.updateSelectionBar();
self.updateCmbLabel(); self.updateCmbLabel();
} }
...@@ -340,9 +347,10 @@ function throttle(func, wait, options) { ...@@ -340,9 +347,10 @@ function throttle(func, wait, options) {
if(this.range) if(this.range)
{ {
this.updateHighHandle(this.valueToOffset(this.scope.rzSliderHigh)); this.updateHighHandle(this.valueToOffset(this.scope.rzSliderHigh));
this.updateSelectionBar();
this.updateCmbLabel(); this.updateCmbLabel();
} }
this.updateSelectionBar();
}, },
/** /**
...@@ -453,6 +461,10 @@ function throttle(func, wait, options) { ...@@ -453,6 +461,10 @@ function throttle(func, wait, options) {
this.cmbLab.remove(); this.cmbLab.remove();
this.maxLab.remove(); this.maxLab.remove();
this.maxH.remove(); this.maxH.remove();
}
if( !this.range && !this.alwaysShowBar)
{
this.selBar.remove(); this.selBar.remove();
} }
}, },
...@@ -517,9 +529,10 @@ function throttle(func, wait, options) { ...@@ -517,9 +529,10 @@ function throttle(func, wait, options) {
if(which === 'rzSliderModel') if(which === 'rzSliderModel')
{ {
this.updateLowHandle(newOffset); this.updateLowHandle(newOffset);
this.updateSelectionBar();
if(this.range) if(this.range)
{ {
this.updateSelectionBar();
this.updateCmbLabel(); this.updateCmbLabel();
} }
return; return;
...@@ -528,9 +541,10 @@ function throttle(func, wait, options) { ...@@ -528,9 +541,10 @@ function throttle(func, wait, options) {
if(which === 'rzSliderHigh') if(which === 'rzSliderHigh')
{ {
this.updateHighHandle(newOffset); this.updateHighHandle(newOffset);
this.updateSelectionBar();
if(this.range) if(this.range)
{ {
this.updateSelectionBar();
this.updateCmbLabel(); this.updateCmbLabel();
} }
return; return;
...@@ -634,8 +648,8 @@ function throttle(func, wait, options) { ...@@ -634,8 +648,8 @@ function throttle(func, wait, options) {
*/ */
updateSelectionBar: function() updateSelectionBar: function()
{ {
this.setWidth(this.selBar, this.maxH.rzsl - this.minH.rzsl); this.setWidth(this.selBar, Math.abs(this.maxH.rzsl - this.minH.rzsl));
this.setLeft(this.selBar, this.minH.rzsl + this.handleHalfWidth); this.setLeft(this.selBar, this.range ? this.minH.rzsl + this.handleHalfWidth : 0);
}, },
/** /**
...@@ -938,7 +952,8 @@ function throttle(func, wait, options) { ...@@ -938,7 +952,8 @@ function throttle(func, wait, options) {
rzSliderModel: '=?', rzSliderModel: '=?',
rzSliderHigh: '=?', rzSliderHigh: '=?',
rzSliderTranslate: '&', rzSliderTranslate: '&',
rzSliderHideLimitLabels: '=?' rzSliderHideLimitLabels: '=?',
rzSliderAlwaysShowBar: '=?'
}, },
template: '<span class="rz-bar"></span>' + // 0 The slider bar template: '<span class="rz-bar"></span>' + // 0 The slider bar
'<span class="rz-bar rz-selection"></span>' + // 1 Highlight between two handles '<span class="rz-bar rz-selection"></span>' + // 1 Highlight between two handles
...@@ -980,6 +995,7 @@ function throttle(func, wait, options) { ...@@ -980,6 +995,7 @@ function throttle(func, wait, options) {
/** /**
* @name Event * @name Event
* @property {Array} touches * @property {Array} touches
* @property {Event} originalEvent
*/ */
/** /**
......
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