root / trunk / web / dojo / dojox / charting / action2d / MoveSlice.js @ 11
History | View | Annotate | Download (2.09 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.charting.action2d.MoveSlice"]){ |
||
| 9 | dojo._hasResource["dojox.charting.action2d.MoveSlice"]=true; |
||
| 10 | dojo.provide("dojox.charting.action2d.MoveSlice");
|
||
| 11 | dojo.require("dojox.charting.action2d.Base");
|
||
| 12 | dojo.require("dojox.gfx.matrix");
|
||
| 13 | dojo.require("dojox.lang.functional");
|
||
| 14 | dojo.require("dojox.lang.functional.scan");
|
||
| 15 | dojo.require("dojox.lang.functional.fold");
|
||
| 16 | (function(){
|
||
| 17 | var _1=1.05,_2=7,m=dojox.gfx.matrix,gf=dojox.gfx.fx,df=dojox.lang.functional; |
||
| 18 | dojo.declare("dojox.charting.action2d.MoveSlice",dojox.charting.action2d.Base,{defaultParams:{duration:400,easing:dojo.fx.easing.backOut,scale:_1,shift:_2},optionalParams:{},constructor:function(_3,_4,_5){ |
||
| 19 | if(!_5){
|
||
| 20 | _5={};
|
||
| 21 | } |
||
| 22 | this.scale=typeof _5.scale=="number"?_5.scale:_1; |
||
| 23 | this.shift=typeof _5.shift=="number"?_5.shift:_2; |
||
| 24 | this.connect();
|
||
| 25 | },process:function(o){ |
||
| 26 | if(!o.shape||o.element!="slice"||!(o.type in this.overOutEvents)){ |
||
| 27 | return;
|
||
| 28 | } |
||
| 29 | if(!this.angles){ |
||
| 30 | var _6=m._degToRad(o.plot.opt.startAngle);
|
||
| 31 | if(typeof o.run.data[0]=="number"){ |
||
| 32 | this.angles=df.map(df.scanl(o.run.data,"+",_6),"* 2 * Math.PI / this",df.foldl(o.run.data,"+",0)); |
||
| 33 | }else{
|
||
| 34 | this.angles=df.map(df.scanl(o.run.data,"a + b.y",_6),"* 2 * Math.PI / this",df.foldl(o.run.data,"a + b.y",0)); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | var _7=o.index,_8,_9,_a,_b,_c,_d=(this.angles[_7]+this.angles[_7+1])/2,_e=m.rotateAt(-_d,o.cx,o.cy),_f=m.rotateAt(_d,o.cx,o.cy); |
||
| 38 | _8=this.anim[_7];
|
||
| 39 | if(_8){
|
||
| 40 | _8.action.stop(true);
|
||
| 41 | }else{
|
||
| 42 | this.anim[_7]=_8={};
|
||
| 43 | } |
||
| 44 | if(o.type=="onmouseover"){ |
||
| 45 | _b=0;
|
||
| 46 | _c=this.shift;
|
||
| 47 | _9=1;
|
||
| 48 | _a=this.scale;
|
||
| 49 | }else{
|
||
| 50 | _b=this.shift;
|
||
| 51 | _c=0;
|
||
| 52 | _9=this.scale;
|
||
| 53 | _a=1;
|
||
| 54 | } |
||
| 55 | _8.action=dojox.gfx.fx.animateTransform({shape:o.shape,duration:this.duration,easing:this.easing,transform:[_f,{name:"translate",start:[_b,0],end:[_c,0]},{name:"scaleAt",start:[_9,o.cx,o.cy],end:[_a,o.cx,o.cy]},_e]});
|
||
| 56 | if(o.type=="onmouseout"){ |
||
| 57 | dojo.connect(_8.action,"onEnd",this,function(){ |
||
| 58 | delete this.anim[_7]; |
||
| 59 | }); |
||
| 60 | } |
||
| 61 | _8.action.play(); |
||
| 62 | },reset:function(){ |
||
| 63 | delete this.angles; |
||
| 64 | }}); |
||
| 65 | })(); |
||
| 66 | } |