source: Dev/branches/rest-dojo-ui/client/dojox/gauges/AnalogArrowIndicator.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.6 KB
Line 
1define(["dojo/_base/declare","./AnalogIndicatorBase"],
2function(declare, AnalogIndicatorBase) {
3
4/*=====
5        AnalogIndicatorBase = dojox.gauges.AnalogIndicatorBase;
6=====*/
7
8return declare("dojox.gauges.AnalogArrowIndicator", [AnalogIndicatorBase],{
9
10        // summary:
11        //              An indicator for the AnalogGauge that draws an arrow. The arrow is drawn on the angle that corresponds
12        // to the value of the indicator.
13       
14        _getShapes: function(group){
15                // summary:
16                //              Override of dojox.gauges.AnalogLineIndicator._getShapes
17                if(!this._gauge){
18                        return null;
19                }
20                var color = this.color ? this.color : 'black';
21                var strokeColor = this.strokeColor ? this.strokeColor : color;
22                var stroke = { color: strokeColor, width: 1};
23                if (this.color.type && !this.strokeColor){
24                        stroke.color = this.color.colors[0].color;
25                }
26                       
27                var x = Math.floor(this.width/2);
28                var head = this.width * 5;
29                var odd = (this.width & 1);
30                var shapes = [];
31                var points = [{x:-x,     y:0},
32                                          {x:-x,         y:-this.length+head},
33                                          {x:-2*x,       y:-this.length+head},
34                                          {x:0,          y:-this.length},
35                                          {x:2*x+odd,y:-this.length+head},
36                                          {x:x+odd,      y:-this.length+head},
37                                          {x:x+odd,      y:0},
38                                          {x:-x,         y:0}];
39                shapes[0] = group.createPolyline(points)
40                                        .setStroke(stroke)
41                                        .setFill(color);
42                shapes[1] = group.createLine({ x1:-x, y1: 0, x2: -x, y2:-this.length+head })
43                                        .setStroke({color: this.highlight});
44                shapes[2] = group.createLine({ x1:-x-3, y1: -this.length+head, x2: 0, y2:-this.length })
45                                        .setStroke({color: this.highlight});
46                shapes[3] = group.createCircle({cx: 0, cy: 0, r: this.width})
47                                        .setStroke(stroke)
48                                        .setFill(color);
49                return shapes;
50        }
51});
52});
Note: See TracBrowser for help on using the repository browser.