diff --git a/README.md b/README.md index 59ac7f6..642f9cd 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ Quinn was developed by [~antw][antw] as part of Quintel Intelligence's Downloads --------- -[Everything (1.0.0)][tarball] +[Everything (1.0.1)][tarball] : Tarball containing JS, CSS, and images -[Development Version (1.0.0)][development-js] -: 30.9kb, JS only, Uncompressed with comments +[Development Version (1.0.1)][development-js] +: 31.8kb, JS only, Uncompressed with comments -[Production Version (1.0.0)][production-js] +[Production Version (1.0.1)][production-js] : 2.6kb, JS only, Minified and Gzipped Table of Contents @@ -339,7 +339,7 @@ all it takes. In some cases, you may need to alter the CSS. For example: History ------- -#### Git HEAD +#### 1.0.1 _May 10th, 2012_ * Added a `strict` option which prevents the initial value being snapped to the `step` value. @@ -525,7 +525,7 @@ and Internet Explorer are not yet complete. [easing]: http://gsgd.co.uk/sandbox/jquery/easing [style-change]: https://github.com/antw/quinn/commit/ea29f2f -[tarball]: https://github.com/antw/quinn/tarball/v1.0.0 +[tarball]: https://github.com/antw/quinn/tarball/v1.0.1 [development-js]: http://antw.github.com/quinn/jquery.quinn.js [production-js]: http://antw.github.com/quinn/jquery.quinn.min.js diff --git a/docs/jquery.quinn.html b/docs/jquery.quinn.html index ab544cc..01dad12 100644 --- a/docs/jquery.quinn.html +++ b/docs/jquery.quinn.html @@ -120,7 +120,7 @@

Quinn

this.previousValue = null; this.drawTo = drawToOpts(opts.drawTo, opts.min, opts.max); - this.model = new Model(this); + this.model = new Model(this, this.options.strict); this.renderer = new this.options.renderer(this); this.wrapperWidth = 0; @@ -161,7 +161,7 @@

Quinn

The current Quinn version.

-
    Quinn.VERSION = '1.0.0';
+
    Quinn.VERSION = '1.0.1';
@@ -859,7 +859,7 @@

Model

(within the range bounds, one of the only values, etc).

-
    function Model (quinn) {
+        
    function Model (quinn, initiallyStrict) {
         var opts, initialValue, length, i;
 
         this.options = opts = quinn.options;
@@ -908,7 +908,7 @@ 

Model

this.values[i] = null; } - this.setValue(initialValue); + this.setValue(initialValue, initiallyStrict); }
@@ -931,7 +931,7 @@

Model

the value you set resulted in no changes.

-
    Model.prototype.setValue = function (newValue) {
+        
    Model.prototype.setValue = function (newValue, strict) {
         var originalValue = this.values, length, i;
 
         if (! _.isArray(newValue)) {
@@ -951,7 +951,7 @@ 

Model

} for (i = 0, length = newValue.length; i < length; i++) { - newValue[i] = this.sanitizeValue(newValue[i]); + newValue[i] = this.sanitizeValue(newValue[i], strict); } if (_.isEqual(newValue, originalValue)) { @@ -1024,8 +1024,10 @@

sanitizeValue

it is within the selectable minima and maxima.

-
    Model.prototype.sanitizeValue = function (value) {
-        value = this.roundToStep(value);
+        
    Model.prototype.sanitizeValue = function (value, strict) {
+        if (strict !== false) {
+            value = this.roundToStep(value);
+        }
 
         if (value > this.maximum) {
             return this.maximum;
@@ -1456,6 +1458,28 @@ 

Options

+

Snaps the initial value to fit with the given “step” value. For +example, given a step of 0.1 and an initial value of 1.05, the +value will be changes to fit the step, and rounded to 1.1.

+ +

Notes:

+ +
    +
  • Even with strict disabled, initial values which are outside +the given min and max will still be changed to fit within +the permitted range.

  • +
  • The strict setting affects the initial value only.

  • +
+ + +
        strict: true,
+ + + + +
+ +

Restrics the values which may be chosen to those listed in the only array.

@@ -1463,10 +1487,10 @@

Options

        only: null,
- +
- +

Disables the slider when initialized so that a user may not change it’s value.

@@ -1475,10 +1499,10 @@

Options

        disable: false,
- +
- +

By default, Quinn fades the opacity of the slider to 50% when disabled, however this may not work perfectly with older Internet @@ -1489,10 +1513,10 @@

Options

        disabledOpacity: 0.5,
- +
- +

If using Quinn on an element which isn’t attached to the DOM, the library won’t be able to determine it’s width; supply it as a @@ -1502,10 +1526,10 @@

Options

        width: null,
- +
- +

If using Quinn on an element which isn’t attached to the DOM, the library won’t be able to determine the width of the handle; suppl @@ -1515,10 +1539,10 @@

Options

        handleWidth: null,
- +
- +

A callback which is run when changing the slider value. Additional callbacks may be added with Quinn::on(‘drag’).

@@ -1531,10 +1555,10 @@

Options

        drag: null,
- +
- +

Run after the user has finished making a change.

@@ -1546,10 +1570,10 @@

Options

        change: null,
- +
- +

Run once after the slider has been constructed.

@@ -1561,10 +1585,10 @@

Options

        setup: null,
- +
- +

An optional class which is used to render the Quinn DOM elements and redraw them when the slider value is changed. This should be @@ -1579,10 +1603,10 @@

Options

        renderer: Quinn.Renderer,
- +
- +

When using animations (such as clicking on the bar), how long should the duration be? Any jQuery effect duration value is @@ -1592,10 +1616,10 @@

Options

        effectSpeed: 'fast',
- +
- +

Set to false to disable all animation on the slider.

@@ -1604,10 +1628,10 @@

Options

};
- +
- +

@@ -1615,10 +1639,10 @@

Options

- +
- +

The jQuery helper function. Permits $(…).quinn();

@@ -1628,10 +1652,10 @@

Options

};
- +
- +

Expose Quinn to the world on $.Quinn.

diff --git a/index.html b/index.html index 79318b2..0c0b6ea 100644 --- a/index.html +++ b/index.html @@ -51,11 +51,11 @@

Quinn

Downloads

-
Everything (1.0.0)
+
Everything (1.0.1)
Tarball containing JS, CSS, and images
-
Development Version (1.0.0)
-
30.9kb, JS only, Uncompressed with comments
-
Production Version (1.0.0)
+
Development Version (1.0.1)
+
31.8kb, JS only, Uncompressed with comments
+
Production Version (1.0.1)
2.6kb, JS only, Minified and Gzipped
@@ -367,7 +367,7 @@

Theming

History

-

Git HEAD

+

1.0.1 May 10th, 2012

  • Added a strict option which prevents the initial value being snapped diff --git a/jquery.quinn.js b/jquery.quinn.js index 131c5ec..1824b70 100644 --- a/jquery.quinn.js +++ b/jquery.quinn.js @@ -95,7 +95,7 @@ } // The current Quinn version. - Quinn.VERSION = '1.0.0'; + Quinn.VERSION = '1.0.1'; // ### Event Handling diff --git a/jquery.quinn.min.js b/jquery.quinn.min.js index e51d935..bc82293 100644 --- a/jquery.quinn.min.js +++ b/jquery.quinn.min.js @@ -1,6 +1,6 @@ (function(e,g){function j(a){var b=a.originalEvent;if(b.touches&&b.touches.length)return b.touches[0].pageX;else if(b.changedTouches&&b.changedTouches.length)return b.changedTouches[0].pageX;return a.pageX}function c(a,b){var d;g.bindAll(this,"clickBar","startDrag","drag","endDrag");this.wrapper=a;this.options=d=g.extend({},c.defaults,b);this.callbacks={};this.disabled=false;this.previousValue=this.activeHandle=null;var h=d.drawTo,f=d.min,e=d.max,h=h||{};this.drawTo={left:g.has(h,"left")?h.left:f, right:g.has(h,"right")?h.right:e};this.model=new i(this,this.options.strict);this.renderer=new this.options.renderer(this);this.wrapperOffset=this.wrapperWidth=0;this.on("setup",d.setup);this.on("begin",d.begin);this.on("drag",d.drag);this.on("change",d.change);this.on("abort",d.abort);g.isFunction(this.renderer.render)&&this.renderer.render();d.disable===true&&this.disable();this.trigger("setup",this.model.value)}function i(a,b){var d,h,f;this.options=d=a.options;this.step=d.step;this.only=d.only; -this.values=[];this.minimum=this.roundToStep(d.min);this.maximum=this.roundToStep(d.max);this.minimumd.max&&(this.maximum-=this.step);d=typeof d.value==="undefined"||d.value===null?this.minimum:g.isArray(d.value)?d.value:[d.value];for(f=0,h=d.length;fd.max&&(this.maximum-=this.step);d=typeof d.value==="undefined"||d.value===null?this.minimum:g.isArray(d.value)?d.value:[d.value];for(f=0,h=d.length;f1&&g.isNumber(a)){if(this.activeHandle===null)return false;e=this.model.sanitizeValue(a);a=g.clone(this.model.values);f=a[this.activeHandle-1];c=a[this.activeHandle+1];f!==null&&e<=f&&(e=f+this.options.step);c!==null&& e>=c&&(e=c-this.options.step);a[this.activeHandle]=e}a=this.model.setValue(a);if(a===false||!d&&!this.trigger("drag",a))return this.model.setValue(h),a!==false&&this.trigger("drag",h),false;this.trigger("redraw",b);return a};c.prototype.stepUp=function(a){return this.model.values.length>1?this.model.value:this.setValue(this.model.value+this.options.step*(a||1))};c.prototype.stepDown=function(a){return this.stepUp(-(a||1))};c.prototype.start=function(){if(this.disabled===true||!this.trigger("begin"))return false;