root / trunk / web / dojo / dojox / widget / gauge / AnalogNeedleIndicator.js
History | View | Annotate | Download (1.12 KB)
| 1 | 9 | andrej.cim | /*
|
|---|---|---|---|
| 2 | Copyright (c) 2004-2010, 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 | |||
| 7 | |||
| 8 | if(!dojo._hasResource["dojox.widget.gauge.AnalogNeedleIndicator"]){ |
||
| 9 | dojo._hasResource["dojox.widget.gauge.AnalogNeedleIndicator"]=true; |
||
| 10 | dojo.provide("dojox.widget.gauge.AnalogNeedleIndicator");
|
||
| 11 | dojo.require("dojox.widget.AnalogGauge");
|
||
| 12 | dojo.experimental("dojox.widget.gauge.AnalogNeedleIndicator");
|
||
| 13 | dojo.declare("dojox.widget.gauge.AnalogNeedleIndicator",[dojox.widget.gauge.AnalogLineIndicator],{_getShapes:function(){ |
||
| 14 | if(!this._gauge){ |
||
| 15 | return null; |
||
| 16 | } |
||
| 17 | var x=Math.floor(this.width/2); |
||
| 18 | var _1=this.width*5; |
||
| 19 | var _2=(this.width&1); |
||
| 20 | var _3=[];
|
||
| 21 | var _4={color:this.color,width:1}; |
||
| 22 | if(this.color.type){ |
||
| 23 | _4.color=this.color.colors[0].color; |
||
| 24 | } |
||
| 25 | var xy=(Math.sqrt(2)*(x)); |
||
| 26 | _3[0]=this._gauge.surface.createPath().setStroke(_4).setFill(this.color).moveTo(xy,-xy).arcTo((2*x),(2*x),0,0,0,-xy,-xy).lineTo(0,-this.length).closePath(); |
||
| 27 | _3[1]=this._gauge.surface.createCircle({cx:0,cy:0,r:this.width}).setStroke({color:this.color}).setFill(this.color); |
||
| 28 | return _3;
|
||
| 29 | }}); |
||
| 30 | } |