diff --git a/README.md b/README.md index d20c58a..a755014 100755 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ UI : * font : font family. * fontWeight : font weight. * bgColor : background color. +* handle : use knob handler. Hooks ------- @@ -138,6 +139,18 @@ Set the value .trigger('change'); ``` +Set the handler +------- + +```html + +``` Supported browser ------- diff --git a/js/jquery.knob.js b/js/jquery.knob.js index 5294ffa..3031e2c 100644 --- a/js/jquery.knob.js +++ b/js/jquery.knob.js @@ -120,6 +120,7 @@ inline: false, step: this.$.data('step') || 1, rotation: this.$.data('rotation'), + handle : false,//handle show or hide (true or false) defaulr false // Hooks draw: null, // function () {} @@ -784,6 +785,22 @@ c.strokeStyle = r ? this.o.fgColor : this.fgColor ; c.arc(this.xy, this.xy, this.radius, a.s, a.e, a.d); c.stroke(); + + /*Set handle knob*/ + if(this.o.handle){ + + var indicatorX =(this.xy)+Math.cos(eat + 0.00001)*this.radius; + var indicatorY =(this.xy)+Math.sin(eat + 0.00001)*this.radius; + + c.beginPath(); + c.arc(indicatorX, indicatorY, this.lineWidth/2, 0, this.PI2, false); + c.fillStyle = this.o.fgColor; + c.fill(); + c.lineWidth = 2; + c.strokeStyle = this.o.bgColor; + c.stroke(); + } + /*Set handle knob*/ }; this.cancel = function () {