jquery-knob.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. $(function () {
  2. $('.knob').knob({
  3. draw: function () {
  4. // "tron" case
  5. if (this.$.data('skin') == 'tron') {
  6. var a = this.angle(this.cv) // Angle
  7. , sa = this.startAngle // Previous start angle
  8. , sat = this.startAngle // Start angle
  9. , ea // Previous end angle
  10. , eat = sat + a // End angle
  11. , r = true;
  12. this.g.lineWidth = this.lineWidth;
  13. this.o.cursor
  14. && (sat = eat - 0.3)
  15. && (eat = eat + 0.3);
  16. if (this.o.displayPrevious) {
  17. ea = this.startAngle + this.angle(this.value);
  18. this.o.cursor
  19. && (sa = ea - 0.3)
  20. && (ea = ea + 0.3);
  21. this.g.beginPath();
  22. this.g.strokeStyle = this.previousColor;
  23. this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sa, ea, false);
  24. this.g.stroke();
  25. }
  26. this.g.beginPath();
  27. this.g.strokeStyle = r ? this.o.fgColor : this.fgColor;
  28. this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sat, eat, false);
  29. this.g.stroke();
  30. this.g.lineWidth = 2;
  31. this.g.beginPath();
  32. this.g.strokeStyle = this.o.fgColor;
  33. this.g.arc(this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
  34. this.g.stroke();
  35. return false;
  36. }
  37. }
  38. });
  39. });