From 4d6b6d4b82fb50bc057ce8192728a44c104aaf4b Mon Sep 17 00:00:00 2001
From: aterrien
Date: Wed, 25 Jun 2014 22:12:27 +0200
Subject: [PATCH 01/16] Add jquery.knob.min.js
---
bower.json | 2 +-
dist/jquery.knob.min.js | 1 +
js/jquery.knob.js | 2 +-
knob.jquery.json | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
create mode 100644 dist/jquery.knob.min.js
diff --git a/bower.json b/bower.json
index eb99c4a..36f9345 100755
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "aterrien/jQuery-Knob",
- "version": "1.2.8",
+ "version": "1.2.9",
"main": "js/jquery.knob.js",
"description": "Nice, downward compatible, touchable, jQuery dial.",
"license": "MIT",
diff --git a/dist/jquery.knob.min.js b/dist/jquery.knob.min.js
new file mode 100644
index 0000000..f342e5a
--- /dev/null
+++ b/dist/jquery.knob.min.js
@@ -0,0 +1 @@
+(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){"use strict";var k={},max=Math.max,min=Math.min;k.c={};k.c.d=$(document);k.c.t=function(e){return e.originalEvent.touches.length-1};k.o=function(){var s=this;this.o=null;this.$=null;this.i=null;this.g=null;this.v=null;this.cv=null;this.x=0;this.y=0;this.w=0;this.h=0;this.$c=null;this.c=null;this.t=0;this.isInit=false;this.fgColor=null;this.pColor=null;this.dH=null;this.cH=null;this.eH=null;this.rH=null;this.scale=1;this.relative=false;this.relativeWidth=false;this.relativeHeight=false;this.$div=null;this.run=function(){var cf=function(e,conf){var k;for(k in conf){s.o[k]=conf[k]}s._carve().init();s._configure()._draw()};if(this.$.data("kontroled"))return;this.$.data("kontroled",true);this.extend();this.o=$.extend({min:this.$.data("min")!==undefined?this.$.data("min"):0,max:this.$.data("max")!==undefined?this.$.data("max"):100,stopper:true,readOnly:this.$.data("readonly")||this.$.attr("readonly")==="readonly",cursor:this.$.data("cursor")===true&&30||this.$.data("cursor")||0,thickness:this.$.data("thickness")&&Math.max(Math.min(this.$.data("thickness"),1),.01)||.35,lineCap:this.$.data("linecap")||"butt",width:this.$.data("width")||200,height:this.$.data("height")||200,displayInput:this.$.data("displayinput")==null||this.$.data("displayinput"),displayPrevious:this.$.data("displayprevious"),fgColor:this.$.data("fgcolor")||"#87CEEB",inputColor:this.$.data("inputcolor"),font:this.$.data("font")||"Arial",fontWeight:this.$.data("font-weight")||"bold",inline:false,step:this.$.data("step")||1,rotation:this.$.data("rotation"),draw:null,change:null,cancel:null,release:null,format:function(v){return v},parse:function(v){return parseFloat(v)}},this.o);this.o.flip=this.o.rotation==="anticlockwise"||this.o.rotation==="acw";if(!this.o.inputColor){this.o.inputColor=this.o.fgColor}if(this.$.is("fieldset")){this.v={};this.i=this.$.find("input");this.i.each(function(k){var $this=$(this);s.i[k]=$this;s.v[k]=s.o.parse($this.val());$this.bind("change blur",function(){var val={};val[k]=$this.val();s.val(val)})});this.$.find("legend").remove()}else{this.i=this.$;this.v=this.o.parse(this.$.val());this.v===""&&(this.v=this.o.min);this.$.bind("change blur",function(){s.val(s._validate(s.o.parse(s.$.val())))})}!this.o.displayInput&&this.$.hide();this.$c=$(document.createElement("canvas")).attr({width:this.o.width,height:this.o.height});this.$div=$('');this.$.wrap(this.$div).before(this.$c);this.$div=this.$.parent();if(typeof G_vmlCanvasManager!=="undefined"){G_vmlCanvasManager.initElement(this.$c[0])}this.c=this.$c[0].getContext?this.$c[0].getContext("2d"):null;if(!this.c){throw{name:"CanvasNotSupportedException",message:"Canvas not supported. Please use excanvas on IE8.0.",toString:function(){return this.name+": "+this.message}}}this.scale=(window.devicePixelRatio||1)/(this.c.webkitBackingStorePixelRatio||this.c.mozBackingStorePixelRatio||this.c.msBackingStorePixelRatio||this.c.oBackingStorePixelRatio||this.c.backingStorePixelRatio||1);this.relativeWidth=this.o.width%1!==0&&this.o.width.indexOf("%");this.relativeHeight=this.o.height%1!==0&&this.o.height.indexOf("%");this.relative=this.relativeWidth||this.relativeHeight;this._carve();if(this.v instanceof Object){this.cv={};this.copy(this.v,this.cv)}else{this.cv=this.v}this.$.bind("configure",cf).parent().bind("configure",cf);this._listen()._configure()._xy().init();this.isInit=true;this.$.val(this.o.format(this.v));this._draw();return this};this._carve=function(){if(this.relative){var w=this.relativeWidth?this.$div.parent().width()*parseInt(this.o.width)/100:this.$div.parent().width(),h=this.relativeHeight?this.$div.parent().height()*parseInt(this.o.height)/100:this.$div.parent().height();this.w=this.h=Math.min(w,h)}else{this.w=this.o.width;this.h=this.o.height}this.$div.css({width:this.w+"px",height:this.h+"px"});this.$c.attr({width:this.w,height:this.h});if(this.scale!==1){this.$c[0].width=this.$c[0].width*this.scale;this.$c[0].height=this.$c[0].height*this.scale;this.$c.width(this.w);this.$c.height(this.h)}return this};this._draw=function(){var d=true;s.g=s.c;s.clear();s.dH&&(d=s.dH());d!==false&&s.draw()};this._touch=function(e){var touchMove=function(e){var v=s.xy2val(e.originalEvent.touches[s.t].pageX,e.originalEvent.touches[s.t].pageY);if(v==s.cv)return;if(s.cH&&s.cH(v)===false)return;s.change(s._validate(v));s._draw()};this.t=k.c.t(e);touchMove(e);k.c.d.bind("touchmove.k",touchMove).bind("touchend.k",function(){k.c.d.unbind("touchmove.k touchend.k");s.val(s.cv)});return this};this._mouse=function(e){var mouseMove=function(e){var v=s.xy2val(e.pageX,e.pageY);if(v==s.cv)return;if(s.cH&&s.cH(v)===false)return;s.change(s._validate(v));s._draw()};mouseMove(e);k.c.d.bind("mousemove.k",mouseMove).bind("keyup.k",function(e){if(e.keyCode===27){k.c.d.unbind("mouseup.k mousemove.k keyup.k");if(s.eH&&s.eH()===false)return;s.cancel()}}).bind("mouseup.k",function(e){k.c.d.unbind("mousemove.k mouseup.k keyup.k");s.val(s.cv)});return this};this._xy=function(){var o=this.$c.offset();this.x=o.left;this.y=o.top;return this};this._listen=function(){if(!this.o.readOnly){this.$c.bind("mousedown",function(e){e.preventDefault();s._xy()._mouse(e)}).bind("touchstart",function(e){e.preventDefault();s._xy()._touch(e)});this.listen()}else{this.$.attr("readonly","readonly")}if(this.relative){$(window).resize(function(){s._carve().init();s._draw()})}return this};this._configure=function(){if(this.o.draw)this.dH=this.o.draw;if(this.o.change)this.cH=this.o.change;if(this.o.cancel)this.eH=this.o.cancel;if(this.o.release)this.rH=this.o.release;if(this.o.displayPrevious){this.pColor=this.h2rgba(this.o.fgColor,"0.4");this.fgColor=this.h2rgba(this.o.fgColor,"0.6")}else{this.fgColor=this.o.fgColor}return this};this._clear=function(){this.$c[0].width=this.$c[0].width};this._validate=function(v){return~~((v<0?-.5:.5)+v/this.o.step)*this.o.step};this.listen=function(){};this.extend=function(){};this.init=function(){};this.change=function(v){};this.val=function(v){};this.xy2val=function(x,y){};this.draw=function(){};this.clear=function(){this._clear()};this.h2rgba=function(h,a){var rgb;h=h.substring(1,7);rgb=[parseInt(h.substring(0,2),16),parseInt(h.substring(2,4),16),parseInt(h.substring(4,6),16)];return"rgba("+rgb[0]+","+rgb[1]+","+rgb[2]+","+a+")"};this.copy=function(f,t){for(var i in f){t[i]=f[i]}}};k.Dial=function(){k.o.call(this);this.startAngle=null;this.xy=null;this.radius=null;this.lineWidth=null;this.cursorExt=null;this.w2=null;this.PI2=2*Math.PI;this.extend=function(){this.o=$.extend({bgColor:this.$.data("bgcolor")||"#EEEEEE",angleOffset:this.$.data("angleoffset")||0,angleArc:this.$.data("anglearc")||360,inline:true},this.o)};this.val=function(v,triggerRelease){if(null!=v){v=this.o.parse(v);if(triggerRelease!==false&&v!=this.v&&this.rH&&this.rH(v)===false)return;this.cv=this.o.stopper?max(min(v,this.o.max),this.o.min):v;this.v=this.cv;this.$.val(this.o.format(this.v));this._draw()}else{return this.v}};this.xy2val=function(x,y){var a,ret;a=Math.atan2(x-(this.x+this.w2),-(y-this.y-this.w2))-this.angleOffset;if(this.o.flip){a=this.angleArc-a-this.PI2}if(this.angleArc!=this.PI2&&a<0&&a>-.5){a=0}else if(a<0){a+=this.PI2}ret=~~(.5+a*(this.o.max-this.o.min)/this.angleArc)+this.o.min;this.o.stopper&&(ret=max(min(ret,this.o.max),this.o.min));return ret};this.listen=function(){var s=this,mwTimerStop,mwTimerRelease,mw=function(e){e.preventDefault();var ori=e.originalEvent,deltaX=ori.detail||ori.wheelDeltaX,deltaY=ori.detail||ori.wheelDeltaY,v=s._validate(s.o.parse(s.$.val()))+(deltaX>0||deltaY>0?s.o.step:deltaX<0||deltaY<0?-s.o.step:0);v=max(min(v,s.o.max),s.o.min);s.val(v,false);if(s.rH){clearTimeout(mwTimerStop);mwTimerStop=setTimeout(function(){s.rH(v);mwTimerStop=null},100);if(!mwTimerRelease){mwTimerRelease=setTimeout(function(){if(mwTimerStop)s.rH(v);mwTimerRelease=null},200)}}},kval,to,m=1,kv={37:-s.o.step,38:s.o.step,39:s.o.step,40:-s.o.step};this.$.bind("keydown",function(e){var kc=e.keyCode;if(kc>=96&&kc<=105){kc=e.keyCode=kc-48}kval=parseInt(String.fromCharCode(kc));if(isNaN(kval)){kc!==13&&kc!==8&&kc!==9&&kc!==189&&(kc!==190||s.$.val().match(/\./))&&e.preventDefault();if($.inArray(kc,[37,38,39,40])>-1){e.preventDefault();var v=s.o.parse(s.$.val())+kv[kc]*m;s.o.stopper&&(v=max(min(v,s.o.max),s.o.min));s.change(v);s._draw();to=window.setTimeout(function(){m*=2},30)}}}).bind("keyup",function(e){if(isNaN(kval)){if(to){window.clearTimeout(to);to=null;m=1;s.val(s.$.val())}}else{s.$.val()>s.o.max&&s.$.val(s.o.max)||s.$.val()this.o.max)this.v=this.o.min;this.$.val(this.v);this.w2=this.w/2;this.cursorExt=this.o.cursor/100;this.xy=this.w2*this.scale;this.lineWidth=this.xy*this.o.thickness;this.lineCap=this.o.lineCap;this.radius=this.xy-this.lineWidth/2;this.o.angleOffset&&(this.o.angleOffset=isNaN(this.o.angleOffset)?0:this.o.angleOffset);this.o.angleArc&&(this.o.angleArc=isNaN(this.o.angleArc)?this.PI2:this.o.angleArc);this.angleOffset=this.o.angleOffset*Math.PI/180;this.angleArc=this.o.angleArc*Math.PI/180;this.startAngle=1.5*Math.PI+this.angleOffset;this.endAngle=1.5*Math.PI+this.angleOffset+this.angleArc;var s=max(String(Math.abs(this.o.max)).length,String(Math.abs(this.o.min)).length,2)+2;this.o.displayInput&&this.i.css({width:(this.w/2+4>>0)+"px",height:(this.w/3>>0)+"px",position:"absolute","vertical-align":"middle","margin-top":(this.w/3>>0)+"px","margin-left":"-"+(this.w*3/4+2>>0)+"px",border:0,background:"none",font:this.o.fontWeight+" "+(this.w/s>>0)+"px "+this.o.font,"text-align":"center",color:this.o.inputColor||this.o.fgColor,padding:"0px","-webkit-appearance":"none"})||this.i.css({width:"0px",visibility:"hidden"})};this.change=function(v){this.cv=v;this.$.val(this.o.format(v))};this.angle=function(v){return(v-this.o.min)*this.angleArc/(this.o.max-this.o.min)};this.arc=function(v){var sa,ea;v=this.angle(v);if(this.o.flip){sa=this.endAngle+1e-5;ea=sa-v-1e-5}else{sa=this.startAngle-1e-5;ea=sa+v+1e-5}this.o.cursor&&(sa=ea-this.cursorExt)&&(ea=ea+this.cursorExt);return{s:sa,e:ea,d:this.o.flip&&!this.o.cursor}};this.draw=function(){var c=this.g,a=this.arc(this.cv),pa,r=1;c.lineWidth=this.lineWidth;c.lineCap=this.lineCap;c.beginPath();c.strokeStyle=this.o.bgColor;c.arc(this.xy,this.xy,this.radius,this.endAngle-1e-5,this.startAngle+1e-5,true);c.stroke();if(this.o.displayPrevious){pa=this.arc(this.v);c.beginPath();c.strokeStyle=this.pColor;c.arc(this.xy,this.xy,this.radius,pa.s,pa.e,pa.d);c.stroke();r=this.cv==this.v}c.beginPath();c.strokeStyle=r?this.o.fgColor:this.fgColor;c.arc(this.xy,this.xy,this.radius,a.s,a.e,a.d);c.stroke()};this.cancel=function(){this.val(this.v)}};$.fn.dial=$.fn.knob=function(o){return this.each(function(){var d=new k.Dial;d.o=o;d.$=$(this);d.run()}).parent()}});
\ No newline at end of file
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 4c927f7..57bbcf4 100755
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -2,7 +2,7 @@
/**
* Downward compatible, touchable dial
*
- * Version: 1.2.8
+ * Version: 1.2.9
* Requires: jQuery v1.7+
*
* Copyright (c) 2012 Anthony Terrien
diff --git a/knob.jquery.json b/knob.jquery.json
index 651b5d1..89a0bce 100755
--- a/knob.jquery.json
+++ b/knob.jquery.json
@@ -9,7 +9,7 @@
"ui",
"input"
],
- "version": "1.2.8",
+ "version": "1.2.9",
"author": {
"name": "Anthony Terrien",
"url": "https://github.com/aterrien"
From 3e2760ebe41b593327eaa5e8e0517044f6ef8a93 Mon Sep 17 00:00:00 2001
From: ido tal
Date: Wed, 2 Jul 2014 02:23:08 +0300
Subject: [PATCH 02/16] Fix #160
---
js/jquery.knob.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 57bbcf4..7cb406e 100755
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -760,10 +760,12 @@
c.lineWidth = this.lineWidth;
c.lineCap = this.lineCap;
- c.beginPath();
- c.strokeStyle = this.o.bgColor;
- c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001, this.startAngle + 0.00001, true);
- c.stroke();
+ if (this.o.bgColor !== "none") {
+ c.beginPath();
+ c.strokeStyle = this.o.bgColor;
+ c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001, this.startAngle + 0.00001, true);
+ c.stroke();
+ }
if (this.o.displayPrevious) {
pa = this.arc(this.v);
From 5e0a6200a591dc502557f2957732bb01d5381d25 Mon Sep 17 00:00:00 2001
From: aterrien
Date: Wed, 9 Jul 2014 21:57:04 +0200
Subject: [PATCH 03/16] Merge 'Fixed Code Style #219'
---
.gitignore | 1 +
dist/jquery.knob.min.js | 0
js/jquery.knob.js | 333 +++++++++++++++++------------------
nbproject/project.properties | 5 +
nbproject/project.xml | 9 +
5 files changed, 181 insertions(+), 167 deletions(-)
create mode 100644 .gitignore
mode change 100644 => 100755 dist/jquery.knob.min.js
create mode 100755 nbproject/project.properties
create mode 100755 nbproject/project.xml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..14bc68c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/dist/jquery.knob.min.js b/dist/jquery.knob.min.js
old mode 100644
new mode 100755
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 7cb406e..22e6175 100755
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -88,43 +88,41 @@
._draw();
};
- if(this.$.data('kontroled')) return;
+ if (this.$.data('kontroled')) return;
this.$.data('kontroled', true);
this.extend();
- this.o = $.extend(
- {
+ this.o = $.extend({
// Config
- min : this.$.data('min') !== undefined ? this.$.data('min') : 0,
- max : this.$.data('max') !== undefined ? this.$.data('max') : 100,
- stopper : true,
- readOnly : this.$.data('readonly') || (this.$.attr('readonly') === 'readonly'),
+ min: this.$.data('min') !== undefined ? this.$.data('min') : 0,
+ max: this.$.data('max') !== undefined ? this.$.data('max') : 100,
+ stopper: true,
+ readOnly: this.$.data('readonly') || (this.$.attr('readonly') === 'readonly'),
// UI
- cursor : (this.$.data('cursor') === true && 30) ||
- this.$.data('cursor') || 0,
- thickness : (
- this.$.data('thickness') &&
- Math.max(Math.min(this.$.data('thickness'), 1), 0.01)
- ) || 0.35,
- lineCap : this.$.data('linecap') || 'butt',
- width : this.$.data('width') || 200,
- height : this.$.data('height') || 200,
- displayInput : this.$.data('displayinput') == null || this.$.data('displayinput'),
- displayPrevious : this.$.data('displayprevious'),
- fgColor : this.$.data('fgcolor') || '#87CEEB',
+ cursor: this.$.data('cursor') === true && 30
+ || this.$.data('cursor') || 0,
+ thickness: this.$.data('thickness')
+ && Math.max(Math.min(this.$.data('thickness'), 1), 0.01)
+ || 0.35,
+ lineCap: this.$.data('linecap') || 'butt',
+ width: this.$.data('width') || 200,
+ height: this.$.data('height') || 200,
+ displayInput: this.$.data('displayinput') == null || this.$.data('displayinput'),
+ displayPrevious: this.$.data('displayprevious'),
+ fgColor: this.$.data('fgcolor') || '#87CEEB',
inputColor: this.$.data('inputcolor'),
font: this.$.data('font') || 'Arial',
fontWeight: this.$.data('font-weight') || 'bold',
- inline : false,
- step : this.$.data('step') || 1,
+ inline: false,
+ step: this.$.data('step') || 1,
rotation: this.$.data('rotation'),
// Hooks
- draw : null, // function () {}
- change : null, // function (value) {}
- cancel : null, // function () {}
- release : null, // function (value) {}
+ draw: null, // function () {}
+ change: null, // function (value) {}
+ cancel: null, // function () {}
+ release: null, // function (value) {}
// Output formatting, allows to add unit: %, ms ...
format: function(v) {
@@ -138,12 +136,12 @@
// finalize options
this.o.flip = this.o.rotation === 'anticlockwise' || this.o.rotation === 'acw';
- if(!this.o.inputColor) {
+ if (!this.o.inputColor) {
this.o.inputColor = this.o.fgColor;
}
// routing value
- if(this.$.is('fieldset')) {
+ if (this.$.is('fieldset')) {
// fieldset = array of integer
this.v = {};
@@ -154,8 +152,8 @@
s.v[k] = s.o.parse($this.val());
$this.bind(
- 'change blur'
- , function () {
+ 'change blur',
+ function () {
var val = {};
val[k] = $this.val();
s.val(val);
@@ -163,24 +161,22 @@
);
});
this.$.find('legend').remove();
-
} else {
// input = integer
this.i = this.$;
this.v = this.o.parse(this.$.val());
- (this.v === '') && (this.v = this.o.min);
-
+ this.v === '' && (this.v = this.o.min);
this.$.bind(
- 'change blur'
- , function () {
+ 'change blur',
+ function () {
s.val(s._validate(s.o.parse(s.$.val())));
}
);
}
- (!this.o.displayInput) && this.$.hide();
+ !this.o.displayInput && this.$.hide();
// adds needed DOM elements (canvas, div)
this.$c = $(document.createElement('canvas')).attr({
@@ -199,7 +195,7 @@
this.$div = this.$.parent();
if (typeof G_vmlCanvasManager !== 'undefined') {
- G_vmlCanvasManager.initElement(this.$c[0]);
+ G_vmlCanvasManager.initElement(this.$c[0]);
}
this.c = this.$c[0].getContext ? this.$c[0].getContext('2d') : null;
@@ -213,21 +209,20 @@
}
// hdpi support
- this.scale = (window.devicePixelRatio || 1) /
- (
+ this.scale = (window.devicePixelRatio || 1) / (
this.c.webkitBackingStorePixelRatio ||
this.c.mozBackingStorePixelRatio ||
this.c.msBackingStorePixelRatio ||
this.c.oBackingStorePixelRatio ||
this.c.backingStorePixelRatio || 1
- );
+ );
// detects relative width / height
- this.relativeWidth = ((this.o.width % 1 !== 0) &&
- this.o.width.indexOf('%'));
- this.relativeHeight = ((this.o.height % 1 !== 0) &&
- this.o.height.indexOf('%'));
- this.relative = (this.relativeWidth || this.relativeHeight);
+ this.relativeWidth = this.o.width % 1 !== 0
+ && this.o.width.indexOf('%');
+ this.relativeHeight = this.o.height % 1 !== 0
+ && this.o.height.indexOf('%');
+ this.relative = this.relativeWidth || this.relativeHeight;
// computes size and carves the component
this._carve();
@@ -261,15 +256,15 @@
};
this._carve = function() {
- if(this.relative) {
+ if (this.relative) {
var w = this.relativeWidth ?
- this.$div.parent().width() *
- parseInt(this.o.width) / 100 :
- this.$div.parent().width(),
+ this.$div.parent().width() *
+ parseInt(this.o.width) / 100
+ : this.$div.parent().width(),
h = this.relativeHeight ?
- this.$div.parent().height() *
- parseInt(this.o.height) / 100 :
- this.$div.parent().height();
+ this.$div.parent().height() *
+ parseInt(this.o.height) / 100
+ : this.$div.parent().height();
// apply relative
this.w = this.h = Math.min(w, h);
@@ -310,25 +305,21 @@
s.clear();
- s.dH
- && (d = s.dH());
-
- (d !== false) && s.draw();
+ s.dH && (d = s.dH());
+ d !== false && s.draw();
};
this._touch = function (e) {
-
var touchMove = function (e) {
-
var v = s.xy2val(
e.originalEvent.touches[s.t].pageX,
e.originalEvent.touches[s.t].pageY
- );
+ );
if (v == s.cv) return;
- if (s.cH && (s.cH(v) === false)) return;
+ if (s.cH && s.cH(v) === false) return;
s.change(s._validate(v));
s._draw();
@@ -344,8 +335,8 @@
k.c.d
.bind("touchmove.k", touchMove)
.bind(
- "touchend.k"
- , function () {
+ "touchend.k",
+ function () {
k.c.d.unbind('touchmove.k touchend.k');
s.val(s.cv);
}
@@ -355,7 +346,6 @@
};
this._mouse = function (e) {
-
var mouseMove = function (e) {
var v = s.xy2val(e.pageX, e.pageY);
@@ -375,23 +365,21 @@
.bind("mousemove.k", mouseMove)
.bind(
// Escape key cancel current change
- "keyup.k"
- , function (e) {
+ "keyup.k",
+ function (e) {
if (e.keyCode === 27) {
k.c.d.unbind("mouseup.k mousemove.k keyup.k");
- if (
- s.eH
- && (s.eH() === false)
- ) return;
+ if (s.eH && s.eH() === false)
+ return;
s.cancel();
}
}
)
.bind(
- "mouseup.k"
- , function (e) {
+ "mouseup.k",
+ function (e) {
k.c.d.unbind('mousemove.k mouseup.k keyup.k');
s.val(s.cv);
}
@@ -404,26 +392,26 @@
var o = this.$c.offset();
this.x = o.left;
this.y = o.top;
+
return this;
};
this._listen = function () {
-
if (!this.o.readOnly) {
this.$c
.bind(
- "mousedown"
- , function (e) {
+ "mousedown",
+ function (e) {
e.preventDefault();
s._xy()._mouse(e);
- }
+ }
)
.bind(
- "touchstart"
- , function (e) {
+ "touchstart",
+ function (e) {
e.preventDefault();
s._xy()._touch(e);
- }
+ }
);
this.listen();
@@ -431,10 +419,9 @@
this.$.attr('readonly', 'readonly');
}
- if(this.relative) {
+ if (this.relative) {
$(window).resize(function() {
- s._carve()
- .init();
+ s._carve().init();
s._draw();
});
}
@@ -464,7 +451,7 @@
this.$c[0].width = this.$c[0].width;
};
- this._validate = function(v) {
+ this._validate = function (v) {
return (~~ (((v < 0) ? -0.5 : 0.5) + (v/this.o.step))) * this.o.step;
};
@@ -482,14 +469,19 @@
this.h2rgba = function (h, a) {
var rgb;
h = h.substring(1,7)
- rgb = [parseInt(h.substring(0,2),16)
- ,parseInt(h.substring(2,4),16)
- ,parseInt(h.substring(4,6),16)];
+ rgb = [
+ parseInt(h.substring(0,2), 16),
+ parseInt(h.substring(2,4), 16),
+ parseInt(h.substring(4,6), 16)
+ ];
+
return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")";
};
this.copy = function (f, t) {
- for (var i in f) { t[i] = f[i]; }
+ for (var i in f) {
+ t[i] = f[i];
+ }
};
};
@@ -509,14 +501,12 @@
this.PI2 = 2*Math.PI;
this.extend = function () {
- this.o = $.extend(
- {
- bgColor : this.$.data('bgcolor') || '#EEEEEE',
- angleOffset : this.$.data('angleoffset') || 0,
- angleArc : this.$.data('anglearc') || 360,
- inline : true
- }, this.o
- );
+ this.o = $.extend({
+ bgColor: this.$.data('bgcolor') || '#EEEEEE',
+ angleOffset: this.$.data('angleoffset') || 0,
+ angleArc: this.$.data('anglearc') || 360,
+ inline: true
+ }, this.o);
};
this.val = function (v, triggerRelease) {
@@ -525,10 +515,10 @@
// reverse format
v = this.o.parse(v);
- if (
- triggerRelease !== false && (v != this.v) && this.rH &&
- (this.rH(v) === false)
- ) return;
+ if (triggerRelease !== false
+ && v != this.v
+ && this.rH
+ && this.rH(v) === false) { return; }
this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
this.v = this.cv;
@@ -543,23 +533,23 @@
var a, ret;
a = Math.atan2(
- x - (this.x + this.w2)
- , - (y - this.y - this.w2)
+ x - (this.x + this.w2),
+ - (y - this.y - this.w2)
) - this.angleOffset;
if (this.o.flip) {
a = this.angleArc - a - this.PI2;
}
- if(this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) {
+ if (this.angleArc != this.PI2 && (a < 0) && (a > -0.5)) {
+
// if isset angleArc option, set to min if .5 under min
a = 0;
} else if (a < 0) {
a += this.PI2;
}
- ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc))
- + this.o.min;
+ ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc)) + this.o.min;
this.o.stopper && (ret = max(min(ret, this.o.max), this.o.min));
@@ -567,60 +557,75 @@
};
this.listen = function () {
+
// bind MouseWheel
- var s = this, mwTimerStop, mwTimerRelease,
+ var s = this, mwTimerStop,
+ mwTimerRelease,
mw = function (e) {
e.preventDefault();
- var ori = e.originalEvent
- ,deltaX = ori.detail || ori.wheelDeltaX
- ,deltaY = ori.detail || ori.wheelDeltaY
- ,v = s._validate(s.o.parse(s.$.val()))
- + (deltaX>0 || deltaY>0 ? s.o.step : deltaX<0 || deltaY<0 ? -s.o.step : 0);
+ var ori = e.originalEvent,
+ deltaX = ori.detail || ori.wheelDeltaX,
+ deltaY = ori.detail || ori.wheelDeltaY,
+ v = s._validate(s.o.parse(s.$.val()))
+ + (
+ deltaX > 0 || deltaY > 0
+ ? s.o.step
+ : deltaX < 0 || deltaY < 0 ? -s.o.step : 0
+ );
v = max(min(v, s.o.max), s.o.min);
s.val(v, false);
- if(s.rH) {
+ if (s.rH) {
// Handle mousewheel stop
clearTimeout(mwTimerStop);
- mwTimerStop = setTimeout(function() {
+ mwTimerStop = setTimeout(function () {
s.rH(v);
mwTimerStop = null;
}, 100);
// Handle mousewheel releases
- if(!mwTimerRelease) {
- mwTimerRelease = setTimeout(function() {
- if(mwTimerStop) s.rH(v);
+ if (!mwTimerRelease) {
+ mwTimerRelease = setTimeout(function () {
+ if (mwTimerStop)
+ s.rH(v);
mwTimerRelease = null;
}, 200);
}
}
- }
- , kval, to, m = 1, kv = {37:-s.o.step, 38:s.o.step, 39:s.o.step, 40:-s.o.step};
+ },
+ kval,
+ to,
+ m = 1,
+ kv = {
+ 37: -s.o.step,
+ 38: s.o.step,
+ 39: s.o.step,
+ 40: -s.o.step
+ };
this.$
.bind(
- "keydown"
- ,function (e) {
+ "keydown",
+ function (e) {
var kc = e.keyCode;
// numpad support
- if(kc >= 96 && kc <= 105) {
+ if (kc >= 96 && kc <= 105) {
kc = e.keyCode = kc - 48;
}
kval = parseInt(String.fromCharCode(kc));
if (isNaN(kval)) {
-
- (kc !== 13) // enter
- && (kc !== 8) // bs
- && (kc !== 9) // tab
- && (kc !== 189) // -
- && (kc !== 190 || s.$.val().match(/\./)) // . only allowed once
+ (kc !== 13) // enter
+ && kc !== 8 // bs
+ && kc !== 9 // tab
+ && kc !== 189 // -
+ && (kc !== 190
+ || s.$.val().match(/\./)) // . allowed once
&& e.preventDefault();
// arrows
@@ -634,16 +639,16 @@
s._draw();
// long time keydown speed-up
- to = window.setTimeout(
- function () { m *= 2; }, 30
- );
+ to = window.setTimeout(function () {
+ m *= 2;
+ }, 30);
}
}
}
)
.bind(
- "keyup"
- ,function (e) {
+ "keyup",
+ function (e) {
if (isNaN(kval)) {
if (to) {
window.clearTimeout(to);
@@ -656,7 +661,6 @@
(s.$.val() > s.o.max && s.$.val(s.o.max))
|| (s.$.val() < s.o.min && s.$.val(s.o.min));
}
-
}
);
@@ -665,11 +669,8 @@
};
this.init = function () {
-
- if (
- this.v < this.o.min
- || this.v > this.o.max
- ) this.v = this.o.min;
+ if (this.v < this.o.min
+ || this.v > this.o.max) { this.v = this.o.min; }
this.$.val(this.v);
this.w2 = this.w / 2;
@@ -694,30 +695,29 @@
this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc;
var s = max(
- String(Math.abs(this.o.max)).length
- , String(Math.abs(this.o.min)).length
- , 2
- ) + 2;
+ String(Math.abs(this.o.max)).length,
+ String(Math.abs(this.o.min)).length,
+ 2
+ ) + 2;
this.o.displayInput
&& this.i.css({
- 'width' : ((this.w / 2 + 4) >> 0) + 'px'
- ,'height' : ((this.w / 3) >> 0) + 'px'
- ,'position' : 'absolute'
- ,'vertical-align' : 'middle'
- ,'margin-top' : ((this.w / 3) >> 0) + 'px'
- ,'margin-left' : '-' + ((this.w * 3 / 4 + 2) >> 0) + 'px'
- ,'border' : 0
- ,'background' : 'none'
- ,'font' : this.o.fontWeight + ' ' + ((this.w / s) >> 0) + 'px ' + this.o.font
- ,'text-align' : 'center'
- ,'color' : this.o.inputColor || this.o.fgColor
- ,'padding' : '0px'
- ,'-webkit-appearance': 'none'
- })
- || this.i.css({
- 'width' : '0px'
- ,'visibility' : 'hidden'
+ 'width' : ((this.w / 2 + 4) >> 0) + 'px',
+ 'height' : ((this.w / 3) >> 0) + 'px',
+ 'position' : 'absolute',
+ 'vertical-align' : 'middle',
+ 'margin-top' : ((this.w / 3) >> 0) + 'px',
+ 'margin-left' : '-' + ((this.w * 3 / 4 + 2) >> 0) + 'px',
+ 'border' : 0,
+ 'background' : 'none',
+ 'font' : this.o.fontWeight + ' ' + ((this.w / s) >> 0) + 'px ' + this.o.font,
+ 'text-align' : 'center',
+ 'color' : this.o.inputColor || this.o.fgColor,
+ 'padding' : '0px',
+ '-webkit-appearance': 'none'
+ }) || this.i.css({
+ 'width': '0px',
+ 'visibility': 'hidden'
});
};
@@ -743,6 +743,7 @@
this.o.cursor
&& (sa = ea - this.cursorExt)
&& (ea = ea + this.cursorExt);
+
return {
s: sa,
e: ea,
@@ -751,11 +752,10 @@
};
this.draw = function () {
-
var c = this.g, // context
- a = this.arc(this.cv) // Arc
- , pa // Previous arc
- , r = 1;
+ a = this.arc(this.cv), // Arc
+ pa, // Previous arc
+ r = 1;
c.lineWidth = this.lineWidth;
c.lineCap = this.lineCap;
@@ -770,15 +770,15 @@
if (this.o.displayPrevious) {
pa = this.arc(this.v);
c.beginPath();
- c.strokeStyle = this.pColor;
- c.arc(this.xy, this.xy, this.radius, pa.s, pa.e, pa.d);
+ c.strokeStyle = this.pColor;
+ c.arc(this.xy, this.xy, this.radius, pa.s, pa.e, pa.d);
c.stroke();
- r = (this.cv == this.v);
+ r = this.cv == this.v;
}
c.beginPath();
- c.strokeStyle = r ? this.o.fgColor : this.fgColor ;
- c.arc(this.xy, this.xy, this.radius, a.s, a.e, a.d);
+ c.strokeStyle = r ? this.o.fgColor : this.fgColor ;
+ c.arc(this.xy, this.xy, this.radius, a.s, a.e, a.d);
c.stroke();
};
@@ -797,6 +797,5 @@
}
).parent();
};
-
+
}));
-
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100755
index 0000000..858f4fd
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,5 @@
+config.folder=
+file.reference.dev-jQuery-Knob=.
+files.encoding=UTF-8
+site.root.folder=${file.reference.dev-jQuery-Knob}
+test.folder=
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100755
index 0000000..d1852e8
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+
+ org.netbeans.modules.web.clientproject
+
+
+ jQuery-Knob
+
+
+
From b3e18cf007cf96172ce13d43e01f0f4902812ea2 Mon Sep 17 00:00:00 2001
From: aterrien
Date: Wed, 9 Jul 2014 22:01:26 +0200
Subject: [PATCH 04/16] Merge 'Fixed Code Style #219'
---
.gitignore | 2 +-
nbproject/project.properties | 5 -----
nbproject/project.xml | 9 ---------
3 files changed, 1 insertion(+), 15 deletions(-)
delete mode 100755 nbproject/project.properties
delete mode 100755 nbproject/project.xml
diff --git a/.gitignore b/.gitignore
index 14bc68c..c094bf5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/nbproject/private/
\ No newline at end of file
+nbproject/
\ No newline at end of file
diff --git a/nbproject/project.properties b/nbproject/project.properties
deleted file mode 100755
index 858f4fd..0000000
--- a/nbproject/project.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-config.folder=
-file.reference.dev-jQuery-Knob=.
-files.encoding=UTF-8
-site.root.folder=${file.reference.dev-jQuery-Knob}
-test.folder=
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100755
index d1852e8..0000000
--- a/nbproject/project.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- org.netbeans.modules.web.clientproject
-
-
- jQuery-Knob
-
-
-
From 6966f4099a2437002fba1b69ac598b2531f25a29 Mon Sep 17 00:00:00 2001
From: aterrien
Date: Wed, 9 Jul 2014 22:02:46 +0200
Subject: [PATCH 05/16] Merge 'Fixed Code Style #219'
---
bower.json | 2 +-
js/jquery.knob.js | 4 ++--
knob.jquery.json | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bower.json b/bower.json
index 36f9345..ab05ab5 100755
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "aterrien/jQuery-Knob",
- "version": "1.2.9",
+ "version": "1.2.10",
"main": "js/jquery.knob.js",
"description": "Nice, downward compatible, touchable, jQuery dial.",
"license": "MIT",
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 22e6175..92b76db 100755
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -2,7 +2,7 @@
/**
* Downward compatible, touchable dial
*
- * Version: 1.2.9
+ * Version: 1.2.10
* Requires: jQuery v1.7+
*
* Copyright (c) 2012 Anthony Terrien
@@ -797,5 +797,5 @@
}
).parent();
};
-
+
}));
diff --git a/knob.jquery.json b/knob.jquery.json
index 89a0bce..4ac5378 100755
--- a/knob.jquery.json
+++ b/knob.jquery.json
@@ -9,7 +9,7 @@
"ui",
"input"
],
- "version": "1.2.9",
+ "version": "1.2.10",
"author": {
"name": "Anthony Terrien",
"url": "https://github.com/aterrien"
From 116e4959738c74126a50b6eb3d335194d270e5ca Mon Sep 17 00:00:00 2001
From: aterrien
Date: Tue, 2 Sep 2014 23:11:16 +0200
Subject: [PATCH 06/16] Fix decimal value #107
---
index.html | 11 ++++++-----
js/jquery.knob.js | 9 +++++----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/index.html b/index.html
index 3928f0c..81f8d7b 100755
--- a/index.html
+++ b/index.html
@@ -156,14 +156,15 @@ jQuery Knob
-
× 5-digit values, step 1000
+
× 4-digit, step 0.1
-data-step="1000"
-data-min="-15000"
-data-max="15000"
+data-step=".1"
+data-min="-10000"
+data-max="10000"
+value="0"
data-displayPrevious=true
-
+
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 92b76db..09ce362 100755
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -156,7 +156,7 @@
function () {
var val = {};
val[k] = $this.val();
- s.val(val);
+ s.val(s._validate(val));
}
);
});
@@ -452,7 +452,8 @@
};
this._validate = function (v) {
- return (~~ (((v < 0) ? -0.5 : 0.5) + (v/this.o.step))) * this.o.step;
+ var val = (~~ (((v < 0) ? -0.5 : 0.5) + (v/this.o.step))) * this.o.step;
+ return Math.round(val * 100) / 100;
};
// Abstract methods
@@ -549,7 +550,7 @@
a += this.PI2;
}
- ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc)) + this.o.min;
+ ret = (a * (this.o.max - this.o.min) / this.angleArc) + this.o.min;
this.o.stopper && (ret = max(min(ret, this.o.max), this.o.min));
@@ -635,7 +636,7 @@
var v = s.o.parse(s.$.val()) + kv[kc] * m;
s.o.stopper && (v = max(min(v, s.o.max), s.o.min));
- s.change(v);
+ s.change(s._validate(v));
s._draw();
// long time keydown speed-up
From f0149509614763b3bc270c7cb70eae6602491711 Mon Sep 17 00:00:00 2001
From: aterrien
Date: Tue, 2 Sep 2014 23:18:53 +0200
Subject: [PATCH 07/16] Fix decimal value #107
---
dist/jquery.knob.min.js | 2 +-
index.html | 2 +-
js/jquery.knob.js | 2 +-
knob.jquery.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dist/jquery.knob.min.js b/dist/jquery.knob.min.js
index f342e5a..72d6ed2 100755
--- a/dist/jquery.knob.min.js
+++ b/dist/jquery.knob.min.js
@@ -1 +1 @@
-(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){"use strict";var k={},max=Math.max,min=Math.min;k.c={};k.c.d=$(document);k.c.t=function(e){return e.originalEvent.touches.length-1};k.o=function(){var s=this;this.o=null;this.$=null;this.i=null;this.g=null;this.v=null;this.cv=null;this.x=0;this.y=0;this.w=0;this.h=0;this.$c=null;this.c=null;this.t=0;this.isInit=false;this.fgColor=null;this.pColor=null;this.dH=null;this.cH=null;this.eH=null;this.rH=null;this.scale=1;this.relative=false;this.relativeWidth=false;this.relativeHeight=false;this.$div=null;this.run=function(){var cf=function(e,conf){var k;for(k in conf){s.o[k]=conf[k]}s._carve().init();s._configure()._draw()};if(this.$.data("kontroled"))return;this.$.data("kontroled",true);this.extend();this.o=$.extend({min:this.$.data("min")!==undefined?this.$.data("min"):0,max:this.$.data("max")!==undefined?this.$.data("max"):100,stopper:true,readOnly:this.$.data("readonly")||this.$.attr("readonly")==="readonly",cursor:this.$.data("cursor")===true&&30||this.$.data("cursor")||0,thickness:this.$.data("thickness")&&Math.max(Math.min(this.$.data("thickness"),1),.01)||.35,lineCap:this.$.data("linecap")||"butt",width:this.$.data("width")||200,height:this.$.data("height")||200,displayInput:this.$.data("displayinput")==null||this.$.data("displayinput"),displayPrevious:this.$.data("displayprevious"),fgColor:this.$.data("fgcolor")||"#87CEEB",inputColor:this.$.data("inputcolor"),font:this.$.data("font")||"Arial",fontWeight:this.$.data("font-weight")||"bold",inline:false,step:this.$.data("step")||1,rotation:this.$.data("rotation"),draw:null,change:null,cancel:null,release:null,format:function(v){return v},parse:function(v){return parseFloat(v)}},this.o);this.o.flip=this.o.rotation==="anticlockwise"||this.o.rotation==="acw";if(!this.o.inputColor){this.o.inputColor=this.o.fgColor}if(this.$.is("fieldset")){this.v={};this.i=this.$.find("input");this.i.each(function(k){var $this=$(this);s.i[k]=$this;s.v[k]=s.o.parse($this.val());$this.bind("change blur",function(){var val={};val[k]=$this.val();s.val(val)})});this.$.find("legend").remove()}else{this.i=this.$;this.v=this.o.parse(this.$.val());this.v===""&&(this.v=this.o.min);this.$.bind("change blur",function(){s.val(s._validate(s.o.parse(s.$.val())))})}!this.o.displayInput&&this.$.hide();this.$c=$(document.createElement("canvas")).attr({width:this.o.width,height:this.o.height});this.$div=$('');this.$.wrap(this.$div).before(this.$c);this.$div=this.$.parent();if(typeof G_vmlCanvasManager!=="undefined"){G_vmlCanvasManager.initElement(this.$c[0])}this.c=this.$c[0].getContext?this.$c[0].getContext("2d"):null;if(!this.c){throw{name:"CanvasNotSupportedException",message:"Canvas not supported. Please use excanvas on IE8.0.",toString:function(){return this.name+": "+this.message}}}this.scale=(window.devicePixelRatio||1)/(this.c.webkitBackingStorePixelRatio||this.c.mozBackingStorePixelRatio||this.c.msBackingStorePixelRatio||this.c.oBackingStorePixelRatio||this.c.backingStorePixelRatio||1);this.relativeWidth=this.o.width%1!==0&&this.o.width.indexOf("%");this.relativeHeight=this.o.height%1!==0&&this.o.height.indexOf("%");this.relative=this.relativeWidth||this.relativeHeight;this._carve();if(this.v instanceof Object){this.cv={};this.copy(this.v,this.cv)}else{this.cv=this.v}this.$.bind("configure",cf).parent().bind("configure",cf);this._listen()._configure()._xy().init();this.isInit=true;this.$.val(this.o.format(this.v));this._draw();return this};this._carve=function(){if(this.relative){var w=this.relativeWidth?this.$div.parent().width()*parseInt(this.o.width)/100:this.$div.parent().width(),h=this.relativeHeight?this.$div.parent().height()*parseInt(this.o.height)/100:this.$div.parent().height();this.w=this.h=Math.min(w,h)}else{this.w=this.o.width;this.h=this.o.height}this.$div.css({width:this.w+"px",height:this.h+"px"});this.$c.attr({width:this.w,height:this.h});if(this.scale!==1){this.$c[0].width=this.$c[0].width*this.scale;this.$c[0].height=this.$c[0].height*this.scale;this.$c.width(this.w);this.$c.height(this.h)}return this};this._draw=function(){var d=true;s.g=s.c;s.clear();s.dH&&(d=s.dH());d!==false&&s.draw()};this._touch=function(e){var touchMove=function(e){var v=s.xy2val(e.originalEvent.touches[s.t].pageX,e.originalEvent.touches[s.t].pageY);if(v==s.cv)return;if(s.cH&&s.cH(v)===false)return;s.change(s._validate(v));s._draw()};this.t=k.c.t(e);touchMove(e);k.c.d.bind("touchmove.k",touchMove).bind("touchend.k",function(){k.c.d.unbind("touchmove.k touchend.k");s.val(s.cv)});return this};this._mouse=function(e){var mouseMove=function(e){var v=s.xy2val(e.pageX,e.pageY);if(v==s.cv)return;if(s.cH&&s.cH(v)===false)return;s.change(s._validate(v));s._draw()};mouseMove(e);k.c.d.bind("mousemove.k",mouseMove).bind("keyup.k",function(e){if(e.keyCode===27){k.c.d.unbind("mouseup.k mousemove.k keyup.k");if(s.eH&&s.eH()===false)return;s.cancel()}}).bind("mouseup.k",function(e){k.c.d.unbind("mousemove.k mouseup.k keyup.k");s.val(s.cv)});return this};this._xy=function(){var o=this.$c.offset();this.x=o.left;this.y=o.top;return this};this._listen=function(){if(!this.o.readOnly){this.$c.bind("mousedown",function(e){e.preventDefault();s._xy()._mouse(e)}).bind("touchstart",function(e){e.preventDefault();s._xy()._touch(e)});this.listen()}else{this.$.attr("readonly","readonly")}if(this.relative){$(window).resize(function(){s._carve().init();s._draw()})}return this};this._configure=function(){if(this.o.draw)this.dH=this.o.draw;if(this.o.change)this.cH=this.o.change;if(this.o.cancel)this.eH=this.o.cancel;if(this.o.release)this.rH=this.o.release;if(this.o.displayPrevious){this.pColor=this.h2rgba(this.o.fgColor,"0.4");this.fgColor=this.h2rgba(this.o.fgColor,"0.6")}else{this.fgColor=this.o.fgColor}return this};this._clear=function(){this.$c[0].width=this.$c[0].width};this._validate=function(v){return~~((v<0?-.5:.5)+v/this.o.step)*this.o.step};this.listen=function(){};this.extend=function(){};this.init=function(){};this.change=function(v){};this.val=function(v){};this.xy2val=function(x,y){};this.draw=function(){};this.clear=function(){this._clear()};this.h2rgba=function(h,a){var rgb;h=h.substring(1,7);rgb=[parseInt(h.substring(0,2),16),parseInt(h.substring(2,4),16),parseInt(h.substring(4,6),16)];return"rgba("+rgb[0]+","+rgb[1]+","+rgb[2]+","+a+")"};this.copy=function(f,t){for(var i in f){t[i]=f[i]}}};k.Dial=function(){k.o.call(this);this.startAngle=null;this.xy=null;this.radius=null;this.lineWidth=null;this.cursorExt=null;this.w2=null;this.PI2=2*Math.PI;this.extend=function(){this.o=$.extend({bgColor:this.$.data("bgcolor")||"#EEEEEE",angleOffset:this.$.data("angleoffset")||0,angleArc:this.$.data("anglearc")||360,inline:true},this.o)};this.val=function(v,triggerRelease){if(null!=v){v=this.o.parse(v);if(triggerRelease!==false&&v!=this.v&&this.rH&&this.rH(v)===false)return;this.cv=this.o.stopper?max(min(v,this.o.max),this.o.min):v;this.v=this.cv;this.$.val(this.o.format(this.v));this._draw()}else{return this.v}};this.xy2val=function(x,y){var a,ret;a=Math.atan2(x-(this.x+this.w2),-(y-this.y-this.w2))-this.angleOffset;if(this.o.flip){a=this.angleArc-a-this.PI2}if(this.angleArc!=this.PI2&&a<0&&a>-.5){a=0}else if(a<0){a+=this.PI2}ret=~~(.5+a*(this.o.max-this.o.min)/this.angleArc)+this.o.min;this.o.stopper&&(ret=max(min(ret,this.o.max),this.o.min));return ret};this.listen=function(){var s=this,mwTimerStop,mwTimerRelease,mw=function(e){e.preventDefault();var ori=e.originalEvent,deltaX=ori.detail||ori.wheelDeltaX,deltaY=ori.detail||ori.wheelDeltaY,v=s._validate(s.o.parse(s.$.val()))+(deltaX>0||deltaY>0?s.o.step:deltaX<0||deltaY<0?-s.o.step:0);v=max(min(v,s.o.max),s.o.min);s.val(v,false);if(s.rH){clearTimeout(mwTimerStop);mwTimerStop=setTimeout(function(){s.rH(v);mwTimerStop=null},100);if(!mwTimerRelease){mwTimerRelease=setTimeout(function(){if(mwTimerStop)s.rH(v);mwTimerRelease=null},200)}}},kval,to,m=1,kv={37:-s.o.step,38:s.o.step,39:s.o.step,40:-s.o.step};this.$.bind("keydown",function(e){var kc=e.keyCode;if(kc>=96&&kc<=105){kc=e.keyCode=kc-48}kval=parseInt(String.fromCharCode(kc));if(isNaN(kval)){kc!==13&&kc!==8&&kc!==9&&kc!==189&&(kc!==190||s.$.val().match(/\./))&&e.preventDefault();if($.inArray(kc,[37,38,39,40])>-1){e.preventDefault();var v=s.o.parse(s.$.val())+kv[kc]*m;s.o.stopper&&(v=max(min(v,s.o.max),s.o.min));s.change(v);s._draw();to=window.setTimeout(function(){m*=2},30)}}}).bind("keyup",function(e){if(isNaN(kval)){if(to){window.clearTimeout(to);to=null;m=1;s.val(s.$.val())}}else{s.$.val()>s.o.max&&s.$.val(s.o.max)||s.$.val()this.o.max)this.v=this.o.min;this.$.val(this.v);this.w2=this.w/2;this.cursorExt=this.o.cursor/100;this.xy=this.w2*this.scale;this.lineWidth=this.xy*this.o.thickness;this.lineCap=this.o.lineCap;this.radius=this.xy-this.lineWidth/2;this.o.angleOffset&&(this.o.angleOffset=isNaN(this.o.angleOffset)?0:this.o.angleOffset);this.o.angleArc&&(this.o.angleArc=isNaN(this.o.angleArc)?this.PI2:this.o.angleArc);this.angleOffset=this.o.angleOffset*Math.PI/180;this.angleArc=this.o.angleArc*Math.PI/180;this.startAngle=1.5*Math.PI+this.angleOffset;this.endAngle=1.5*Math.PI+this.angleOffset+this.angleArc;var s=max(String(Math.abs(this.o.max)).length,String(Math.abs(this.o.min)).length,2)+2;this.o.displayInput&&this.i.css({width:(this.w/2+4>>0)+"px",height:(this.w/3>>0)+"px",position:"absolute","vertical-align":"middle","margin-top":(this.w/3>>0)+"px","margin-left":"-"+(this.w*3/4+2>>0)+"px",border:0,background:"none",font:this.o.fontWeight+" "+(this.w/s>>0)+"px "+this.o.font,"text-align":"center",color:this.o.inputColor||this.o.fgColor,padding:"0px","-webkit-appearance":"none"})||this.i.css({width:"0px",visibility:"hidden"})};this.change=function(v){this.cv=v;this.$.val(this.o.format(v))};this.angle=function(v){return(v-this.o.min)*this.angleArc/(this.o.max-this.o.min)};this.arc=function(v){var sa,ea;v=this.angle(v);if(this.o.flip){sa=this.endAngle+1e-5;ea=sa-v-1e-5}else{sa=this.startAngle-1e-5;ea=sa+v+1e-5}this.o.cursor&&(sa=ea-this.cursorExt)&&(ea=ea+this.cursorExt);return{s:sa,e:ea,d:this.o.flip&&!this.o.cursor}};this.draw=function(){var c=this.g,a=this.arc(this.cv),pa,r=1;c.lineWidth=this.lineWidth;c.lineCap=this.lineCap;c.beginPath();c.strokeStyle=this.o.bgColor;c.arc(this.xy,this.xy,this.radius,this.endAngle-1e-5,this.startAngle+1e-5,true);c.stroke();if(this.o.displayPrevious){pa=this.arc(this.v);c.beginPath();c.strokeStyle=this.pColor;c.arc(this.xy,this.xy,this.radius,pa.s,pa.e,pa.d);c.stroke();r=this.cv==this.v}c.beginPath();c.strokeStyle=r?this.o.fgColor:this.fgColor;c.arc(this.xy,this.xy,this.radius,a.s,a.e,a.d);c.stroke()};this.cancel=function(){this.val(this.v)}};$.fn.dial=$.fn.knob=function(o){return this.each(function(){var d=new k.Dial;d.o=o;d.$=$(this);d.run()}).parent()}});
\ No newline at end of file
+(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){"use strict";var t={},n=Math.max,r=Math.min;t.c={};t.c.d=e(document);t.c.t=function(e){return e.originalEvent.touches.length-1};t.o=function(){var n=this;this.o=null;this.$=null;this.i=null;this.g=null;this.v=null;this.cv=null;this.x=0;this.y=0;this.w=0;this.h=0;this.$c=null;this.c=null;this.t=0;this.isInit=false;this.fgColor=null;this.pColor=null;this.dH=null;this.cH=null;this.eH=null;this.rH=null;this.scale=1;this.relative=false;this.relativeWidth=false;this.relativeHeight=false;this.$div=null;this.run=function(){var t=function(e,t){var r;for(r in t){n.o[r]=t[r]}n._carve().init();n._configure()._draw()};if(this.$.data("kontroled"))return;this.$.data("kontroled",true);this.extend();this.o=e.extend({min:this.$.data("min")!==undefined?this.$.data("min"):0,max:this.$.data("max")!==undefined?this.$.data("max"):100,stopper:true,readOnly:this.$.data("readonly")||this.$.attr("readonly")==="readonly",cursor:this.$.data("cursor")===true&&30||this.$.data("cursor")||0,thickness:this.$.data("thickness")&&Math.max(Math.min(this.$.data("thickness"),1),.01)||.35,lineCap:this.$.data("linecap")||"butt",width:this.$.data("width")||200,height:this.$.data("height")||200,displayInput:this.$.data("displayinput")==null||this.$.data("displayinput"),displayPrevious:this.$.data("displayprevious"),fgColor:this.$.data("fgcolor")||"#87CEEB",inputColor:this.$.data("inputcolor"),font:this.$.data("font")||"Arial",fontWeight:this.$.data("font-weight")||"bold",inline:false,step:this.$.data("step")||1,rotation:this.$.data("rotation"),draw:null,change:null,cancel:null,release:null,format:function(e){return e},parse:function(e){return parseFloat(e)}},this.o);this.o.flip=this.o.rotation==="anticlockwise"||this.o.rotation==="acw";if(!this.o.inputColor){this.o.inputColor=this.o.fgColor}if(this.$.is("fieldset")){this.v={};this.i=this.$.find("input");this.i.each(function(t){var r=e(this);n.i[t]=r;n.v[t]=n.o.parse(r.val());r.bind("change blur",function(){var e={};e[t]=r.val();n.val(n._validate(e))})});this.$.find("legend").remove()}else{this.i=this.$;this.v=this.o.parse(this.$.val());this.v===""&&(this.v=this.o.min);this.$.bind("change blur",function(){n.val(n._validate(n.o.parse(n.$.val())))})}!this.o.displayInput&&this.$.hide();this.$c=e(document.createElement("canvas")).attr({width:this.o.width,height:this.o.height});this.$div=e('');this.$.wrap(this.$div).before(this.$c);this.$div=this.$.parent();if(typeof G_vmlCanvasManager!=="undefined"){G_vmlCanvasManager.initElement(this.$c[0])}this.c=this.$c[0].getContext?this.$c[0].getContext("2d"):null;if(!this.c){throw{name:"CanvasNotSupportedException",message:"Canvas not supported. Please use excanvas on IE8.0.",toString:function(){return this.name+": "+this.message}}}this.scale=(window.devicePixelRatio||1)/(this.c.webkitBackingStorePixelRatio||this.c.mozBackingStorePixelRatio||this.c.msBackingStorePixelRatio||this.c.oBackingStorePixelRatio||this.c.backingStorePixelRatio||1);this.relativeWidth=this.o.width%1!==0&&this.o.width.indexOf("%");this.relativeHeight=this.o.height%1!==0&&this.o.height.indexOf("%");this.relative=this.relativeWidth||this.relativeHeight;this._carve();if(this.v instanceof Object){this.cv={};this.copy(this.v,this.cv)}else{this.cv=this.v}this.$.bind("configure",t).parent().bind("configure",t);this._listen()._configure()._xy().init();this.isInit=true;this.$.val(this.o.format(this.v));this._draw();return this};this._carve=function(){if(this.relative){var e=this.relativeWidth?this.$div.parent().width()*parseInt(this.o.width)/100:this.$div.parent().width(),t=this.relativeHeight?this.$div.parent().height()*parseInt(this.o.height)/100:this.$div.parent().height();this.w=this.h=Math.min(e,t)}else{this.w=this.o.width;this.h=this.o.height}this.$div.css({width:this.w+"px",height:this.h+"px"});this.$c.attr({width:this.w,height:this.h});if(this.scale!==1){this.$c[0].width=this.$c[0].width*this.scale;this.$c[0].height=this.$c[0].height*this.scale;this.$c.width(this.w);this.$c.height(this.h)}return this};this._draw=function(){var e=true;n.g=n.c;n.clear();n.dH&&(e=n.dH());e!==false&&n.draw()};this._touch=function(e){var r=function(e){var t=n.xy2val(e.originalEvent.touches[n.t].pageX,e.originalEvent.touches[n.t].pageY);if(t==n.cv)return;if(n.cH&&n.cH(t)===false)return;n.change(n._validate(t));n._draw()};this.t=t.c.t(e);r(e);t.c.d.bind("touchmove.k",r).bind("touchend.k",function(){t.c.d.unbind("touchmove.k touchend.k");n.val(n.cv)});return this};this._mouse=function(e){var r=function(e){var t=n.xy2val(e.pageX,e.pageY);if(t==n.cv)return;if(n.cH&&n.cH(t)===false)return;n.change(n._validate(t));n._draw()};r(e);t.c.d.bind("mousemove.k",r).bind("keyup.k",function(e){if(e.keyCode===27){t.c.d.unbind("mouseup.k mousemove.k keyup.k");if(n.eH&&n.eH()===false)return;n.cancel()}}).bind("mouseup.k",function(e){t.c.d.unbind("mousemove.k mouseup.k keyup.k");n.val(n.cv)});return this};this._xy=function(){var e=this.$c.offset();this.x=e.left;this.y=e.top;return this};this._listen=function(){if(!this.o.readOnly){this.$c.bind("mousedown",function(e){e.preventDefault();n._xy()._mouse(e)}).bind("touchstart",function(e){e.preventDefault();n._xy()._touch(e)});this.listen()}else{this.$.attr("readonly","readonly")}if(this.relative){e(window).resize(function(){n._carve().init();n._draw()})}return this};this._configure=function(){if(this.o.draw)this.dH=this.o.draw;if(this.o.change)this.cH=this.o.change;if(this.o.cancel)this.eH=this.o.cancel;if(this.o.release)this.rH=this.o.release;if(this.o.displayPrevious){this.pColor=this.h2rgba(this.o.fgColor,"0.4");this.fgColor=this.h2rgba(this.o.fgColor,"0.6")}else{this.fgColor=this.o.fgColor}return this};this._clear=function(){this.$c[0].width=this.$c[0].width};this._validate=function(e){var t=~~((e<0?-.5:.5)+e/this.o.step)*this.o.step;return Math.round(t*100)/100};this.listen=function(){};this.extend=function(){};this.init=function(){};this.change=function(e){};this.val=function(e){};this.xy2val=function(e,t){};this.draw=function(){};this.clear=function(){this._clear()};this.h2rgba=function(e,t){var n;e=e.substring(1,7);n=[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)];return"rgba("+n[0]+","+n[1]+","+n[2]+","+t+")"};this.copy=function(e,t){for(var n in e){t[n]=e[n]}}};t.Dial=function(){t.o.call(this);this.startAngle=null;this.xy=null;this.radius=null;this.lineWidth=null;this.cursorExt=null;this.w2=null;this.PI2=2*Math.PI;this.extend=function(){this.o=e.extend({bgColor:this.$.data("bgcolor")||"#EEEEEE",angleOffset:this.$.data("angleoffset")||0,angleArc:this.$.data("anglearc")||360,inline:true},this.o)};this.val=function(e,t){if(null!=e){e=this.o.parse(e);if(t!==false&&e!=this.v&&this.rH&&this.rH(e)===false){return}this.cv=this.o.stopper?n(r(e,this.o.max),this.o.min):e;this.v=this.cv;this.$.val(this.o.format(this.v));this._draw()}else{return this.v}};this.xy2val=function(e,t){var i,s;i=Math.atan2(e-(this.x+this.w2),-(t-this.y-this.w2))-this.angleOffset;if(this.o.flip){i=this.angleArc-i-this.PI2}if(this.angleArc!=this.PI2&&i<0&&i>-.5){i=0}else if(i<0){i+=this.PI2}s=i*(this.o.max-this.o.min)/this.angleArc+this.o.min;this.o.stopper&&(s=n(r(s,this.o.max),this.o.min));return s};this.listen=function(){var t=this,i,s,o=function(e){e.preventDefault();var o=e.originalEvent,u=o.detail||o.wheelDeltaX,a=o.detail||o.wheelDeltaY,f=t._validate(t.o.parse(t.$.val()))+(u>0||a>0?t.o.step:u<0||a<0?-t.o.step:0);f=n(r(f,t.o.max),t.o.min);t.val(f,false);if(t.rH){clearTimeout(i);i=setTimeout(function(){t.rH(f);i=null},100);if(!s){s=setTimeout(function(){if(i)t.rH(f);s=null},200)}}},u,a,f=1,l={37:-t.o.step,38:t.o.step,39:t.o.step,40:-t.o.step};this.$.bind("keydown",function(i){var s=i.keyCode;if(s>=96&&s<=105){s=i.keyCode=s-48}u=parseInt(String.fromCharCode(s));if(isNaN(u)){s!==13&&s!==8&&s!==9&&s!==189&&(s!==190||t.$.val().match(/\./))&&i.preventDefault();if(e.inArray(s,[37,38,39,40])>-1){i.preventDefault();var o=t.o.parse(t.$.val())+l[s]*f;t.o.stopper&&(o=n(r(o,t.o.max),t.o.min));t.change(t._validate(o));t._draw();a=window.setTimeout(function(){f*=2},30)}}}).bind("keyup",function(e){if(isNaN(u)){if(a){window.clearTimeout(a);a=null;f=1;t.val(t.$.val())}}else{t.$.val()>t.o.max&&t.$.val(t.o.max)||t.$.val()this.o.max){this.v=this.o.min}this.$.val(this.v);this.w2=this.w/2;this.cursorExt=this.o.cursor/100;this.xy=this.w2*this.scale;this.lineWidth=this.xy*this.o.thickness;this.lineCap=this.o.lineCap;this.radius=this.xy-this.lineWidth/2;this.o.angleOffset&&(this.o.angleOffset=isNaN(this.o.angleOffset)?0:this.o.angleOffset);this.o.angleArc&&(this.o.angleArc=isNaN(this.o.angleArc)?this.PI2:this.o.angleArc);this.angleOffset=this.o.angleOffset*Math.PI/180;this.angleArc=this.o.angleArc*Math.PI/180;this.startAngle=1.5*Math.PI+this.angleOffset;this.endAngle=1.5*Math.PI+this.angleOffset+this.angleArc;var e=n(String(Math.abs(this.o.max)).length,String(Math.abs(this.o.min)).length,2)+2;this.o.displayInput&&this.i.css({width:(this.w/2+4>>0)+"px",height:(this.w/3>>0)+"px",position:"absolute","vertical-align":"middle","margin-top":(this.w/3>>0)+"px","margin-left":"-"+(this.w*3/4+2>>0)+"px",border:0,background:"none",font:this.o.fontWeight+" "+(this.w/e>>0)+"px "+this.o.font,"text-align":"center",color:this.o.inputColor||this.o.fgColor,padding:"0px","-webkit-appearance":"none"})||this.i.css({width:"0px",visibility:"hidden"})};this.change=function(e){this.cv=e;this.$.val(this.o.format(e))};this.angle=function(e){return(e-this.o.min)*this.angleArc/(this.o.max-this.o.min)};this.arc=function(e){var t,n;e=this.angle(e);if(this.o.flip){t=this.endAngle+1e-5;n=t-e-1e-5}else{t=this.startAngle-1e-5;n=t+e+1e-5}this.o.cursor&&(t=n-this.cursorExt)&&(n=n+this.cursorExt);return{s:t,e:n,d:this.o.flip&&!this.o.cursor}};this.draw=function(){var e=this.g,t=this.arc(this.cv),n,r=1;e.lineWidth=this.lineWidth;e.lineCap=this.lineCap;if(this.o.bgColor!=="none"){e.beginPath();e.strokeStyle=this.o.bgColor;e.arc(this.xy,this.xy,this.radius,this.endAngle-1e-5,this.startAngle+1e-5,true);e.stroke()}if(this.o.displayPrevious){n=this.arc(this.v);e.beginPath();e.strokeStyle=this.pColor;e.arc(this.xy,this.xy,this.radius,n.s,n.e,n.d);e.stroke();r=this.cv==this.v}e.beginPath();e.strokeStyle=r?this.o.fgColor:this.fgColor;e.arc(this.xy,this.xy,this.radius,t.s,t.e,t.d);e.stroke()};this.cancel=function(){this.val(this.v)}};e.fn.dial=e.fn.knob=function(n){return this.each(function(){var r=new t.Dial;r.o=n;r.$=e(this);r.run()}).parent()}})
\ No newline at end of file
diff --git a/index.html b/index.html
index 81f8d7b..f5ecfc7 100755
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
jQuery Knob demo
-
+
+
+```
Options
-------
Options are provided as attributes 'data-option':
-
+```html
+
+```
... or in the "knob()" call :
- $(".dial").knob({
- 'min':-50
- ,'max':50
- });
+```javascript
+$(".dial").knob({
+ 'min':-50,
+ 'max':50
+});
+```
The following options are supported :
@@ -58,11 +64,13 @@ UI :
Hooks
-------
-
+ 'release' : function (v) { /*make something*/ }
+ });
+
+```
* 'release' : executed on release
@@ -92,40 +100,44 @@ The scope (this) of each hook function is the current Knob instance (refer to th
Example
-------
-
+```html
+
-
-
+ 'change' : function (v) { console.log(v); }
+ });
+
+```
Dynamically configure
-------
-
+ }
+ );
+
+```
Set the value
-------
-
+
+```
Supported browser
-------
From 4fb9bab8d87c4e705cdb1ea47d00b5190191b29e Mon Sep 17 00:00:00 2001
From: Felix Milea-Ciobanu
Date: Tue, 14 Jul 2015 10:54:38 -0600
Subject: [PATCH 11/16] added basic package.json for npm package
---
package.json | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 package.json
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..28b7fb1
--- /dev/null
+++ b/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "jquery-knob",
+ "version": "1.2.11",
+ "description": "Nice, downward compatible, touchable, jQuery dial",
+ "main": "dist/jquery.knob.min.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/aterrien/jQuery-Knob.git"
+ },
+ "keywords": [
+ "jquery",
+ "knob",
+ "dial"
+ ],
+ "author": "Anthony Terrien",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/aterrien/jQuery-Knob/issues"
+ },
+ "homepage": "https://github.com/aterrien/jQuery-Knob#readme"
+}
From cf505336e7c50e3b6eae1210d321d27832d5ff90 Mon Sep 17 00:00:00 2001
From: legitalk
Date: Wed, 14 Oct 2015 10:04:42 +0200
Subject: [PATCH 12/16] Update jquery.knob.js
Missing ";"
---
js/jquery.knob.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 5294ffa..44220f2 100644
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -472,7 +472,7 @@
// Utils
this.h2rgba = function (h, a) {
var rgb;
- h = h.substring(1,7)
+ h = h.substring(1,7);
rgb = [
parseInt(h.substring(0,2), 16),
parseInt(h.substring(2,4), 16),
From 28bb63e72a2de1571fd6d1e25d9f1855d820fa4a Mon Sep 17 00:00:00 2001
From: legitalk
Date: Wed, 14 Oct 2015 10:11:21 +0200
Subject: [PATCH 13/16] Update
Missing 3x ";"
---
js/jquery.knob.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 5294ffa..8bae662 100644
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -297,7 +297,7 @@
}
return this;
- }
+ };
this._draw = function () {
@@ -472,7 +472,7 @@
// Utils
this.h2rgba = function (h, a) {
var rgb;
- h = h.substring(1,7)
+ h = h.substring(1,7);
rgb = [
parseInt(h.substring(0,2), 16),
parseInt(h.substring(2,4), 16),
@@ -669,7 +669,7 @@
);
this.$c.bind("mousewheel DOMMouseScroll", mw);
- this.$.bind("mousewheel DOMMouseScroll", mw)
+ this.$.bind("mousewheel DOMMouseScroll", mw);
};
this.init = function () {
From 148307aa5475980dbc85133f16e7cf88cf03fde8 Mon Sep 17 00:00:00 2001
From: Jason Williams
Date: Fri, 23 Oct 2015 16:58:23 +0100
Subject: [PATCH 14/16] adding height to dial documentation
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index d20c58a..2257ff4 100755
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ UI :
* thickness : gauge thickness.
* lineCap : gauge stroke endings. | default=butt, round=rounded line endings
* width : dial width.
+* height : dial height.
* displayInput : default=true | false=hide input.
* displayPrevious : default=false | true=displays the previous value with transparency.
* fgColor : foreground color.
From fa1c321fd1a9a471130a1a56746462c8330bcf7b Mon Sep 17 00:00:00 2001
From: aterrien
Date: Tue, 3 Nov 2015 21:13:28 +0000
Subject: [PATCH 15/16] Release 1.2.12, fix bower version and add npm package
---
bower.json | 2 +-
js/jquery.knob.js | 2 +-
knob.jquery.json | 2 +-
package.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bower.json b/bower.json
index 7969769..ef03e4e 100755
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "aterrien/jQuery-Knob",
- "version": "1.2.11",
+ "version": "1.2.12",
"main": "js/jquery.knob.js",
"description": "Nice, downward compatible, touchable, jQuery dial.",
"license": "MIT",
diff --git a/js/jquery.knob.js b/js/jquery.knob.js
index 8bae662..792313c 100644
--- a/js/jquery.knob.js
+++ b/js/jquery.knob.js
@@ -2,7 +2,7 @@
/**
* Downward compatible, touchable dial
*
- * Version: 1.2.11
+ * Version: 1.2.12
* Requires: jQuery v1.7+
*
* Copyright (c) 2012 Anthony Terrien
diff --git a/knob.jquery.json b/knob.jquery.json
index 26564ad..c442552 100755
--- a/knob.jquery.json
+++ b/knob.jquery.json
@@ -9,7 +9,7 @@
"ui",
"input"
],
- "version": "1.2.11",
+ "version": "1.2.12",
"author": {
"name": "Anthony Terrien",
"url": "https://github.com/aterrien"
diff --git a/package.json b/package.json
index 28b7fb1..de9f0ce 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery-knob",
- "version": "1.2.11",
+ "version": "1.2.12",
"description": "Nice, downward compatible, touchable, jQuery dial",
"main": "dist/jquery.knob.min.js",
"scripts": {
From 755309e933d326ffaa5a2d758dc377147b766515 Mon Sep 17 00:00:00 2001
From: Anthony Terrien
Date: Wed, 16 Dec 2015 21:12:42 +0100
Subject: [PATCH 16/16] Changed bower package name to jquery-knob
---
bower.json | 4 ++--
knob.jquery.json | 2 +-
package.json | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bower.json b/bower.json
index ef03e4e..1eeb316 100755
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
- "name": "aterrien/jQuery-Knob",
- "version": "1.2.12",
+ "name": "jquery-knob",
+ "version": "1.2.13",
"main": "js/jquery.knob.js",
"description": "Nice, downward compatible, touchable, jQuery dial.",
"license": "MIT",
diff --git a/knob.jquery.json b/knob.jquery.json
index c442552..01a9063 100755
--- a/knob.jquery.json
+++ b/knob.jquery.json
@@ -9,7 +9,7 @@
"ui",
"input"
],
- "version": "1.2.12",
+ "version": "1.2.13",
"author": {
"name": "Anthony Terrien",
"url": "https://github.com/aterrien"
diff --git a/package.json b/package.json
index de9f0ce..fbb4245 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery-knob",
- "version": "1.2.12",
+ "version": "1.2.13",
"description": "Nice, downward compatible, touchable, jQuery dial",
"main": "dist/jquery.knob.min.js",
"scripts": {