diff options
Diffstat (limited to 'js/dojo-1.7.2/dojox/gauges/AnalogNeedleIndicator.js')
| -rw-r--r-- | js/dojo-1.7.2/dojox/gauges/AnalogNeedleIndicator.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/gauges/AnalogNeedleIndicator.js b/js/dojo-1.7.2/dojox/gauges/AnalogNeedleIndicator.js new file mode 100644 index 0000000..441795e --- /dev/null +++ b/js/dojo-1.7.2/dojox/gauges/AnalogNeedleIndicator.js @@ -0,0 +1,47 @@ +//>>built +define("dojox/gauges/AnalogNeedleIndicator", ["dojo/_base/declare","./AnalogIndicatorBase"], + function(declare, AnalogIndicatorBase) { + +/*===== + AnalogIndicatorBase = dojox.gauges.AnalogIndicatorBase; +=====*/ + +return declare("dojox.gauges.AnalogNeedleIndicator", [AnalogIndicatorBase], { + // summary: + // An indicator for the AnalogGauge that draws a needle. The needle is drawn on the angle that corresponds + // to the value of the indicator. + + _getShapes: function(group){ + // summary: + // Override of dojox.gauges.AnalogLineIndicator._getShapes + if(!this._gauge){ + return null; + } + var x = Math.floor(this.width/2); + var shapes = []; + + var color = this.color ? this.color : 'black'; + var strokeColor = this.strokeColor ? this.strokeColor : color; + var strokeWidth = this.strokeWidth ? this.strokeWidth : 1; + + var stroke = { + color: strokeColor, + width: strokeWidth + }; + + if (color.type && !this.strokeColor){ + stroke.color = color.colors[0].color; + } + + var xy = (Math.sqrt(2) * (x)); + shapes[0] = group.createPath() + .setStroke(stroke).setFill(color) + .moveTo(xy, -xy).arcTo((2*x), (2*x), 0, 0, 0, -xy, -xy) + .lineTo(0, -this.length).closePath(); + shapes[1] = group.createCircle({cx: 0, cy: 0, r: this.width}) + .setStroke(stroke) + .setFill(color); + return shapes; + } +}); +}); |
