AnalogArrowIndicator.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource['dojox.widget.gauge.AnalogArrowIndicator']){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource['dojox.widget.gauge.AnalogArrowIndicator'] = true;
  8. dojo.provide('dojox.widget.gauge.AnalogArrowIndicator');
  9. dojo.require('dojox.widget.AnalogGauge');
  10. dojo.experimental("dojox.widget.gauge.AnalogArrowIndicator");
  11. dojo.declare("dojox.widget.gauge.AnalogArrowIndicator",[dojox.widget.gauge.AnalogLineIndicator],{
  12. _getShapes: function(){
  13. // summary:
  14. // Override of dojox.widget.AnalogLineIndicator._getShapes
  15. if(!this._gauge){
  16. return null;
  17. }
  18. var x = Math.floor(this.width/2);
  19. var head = this.width * 5;
  20. var odd = (this.width & 1);
  21. var shapes = [];
  22. var points = [{x:-x, y:0},
  23. {x:-x, y:-this.length+head},
  24. {x:-2*x, y:-this.length+head},
  25. {x:0, y:-this.length},
  26. {x:2*x+odd,y:-this.length+head},
  27. {x:x+odd, y:-this.length+head},
  28. {x:x+odd, y:0},
  29. {x:-x, y:0}];
  30. shapes[0] = this._gauge.surface.createPolyline(points)
  31. .setStroke({color: this.color})
  32. .setFill(this.color);
  33. shapes[1] = this._gauge.surface.createLine({ x1:-x, y1: 0, x2: -x, y2:-this.length+head })
  34. .setStroke({color: this.highlight});
  35. shapes[2] = this._gauge.surface.createLine({ x1:-x-3, y1: -this.length+head, x2: 0, y2:-this.length })
  36. .setStroke({color: this.highlight});
  37. shapes[3] = this._gauge.surface.createCircle({cx: 0, cy: 0, r: this.width})
  38. .setStroke({color: this.color})
  39. .setFill(this.color);
  40. return shapes;
  41. }
  42. });
  43. }