Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / charting / action2d / Highlight.js @ 12

History | View | Annotate | Download (1.72 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.Highlight"]){
9
dojo._hasResource["dojox.charting.action2d.Highlight"]=true;
10
dojo.provide("dojox.charting.action2d.Highlight");
11
dojo.require("dojox.charting.action2d.Base");
12
dojo.require("dojox.color");
13
(function(){
14
var _1=100,_2=75,_3=50,c=dojox.color,cc=function(_4){
15
return function(){
16
return _4;
17
};
18
},hl=function(_5){
19
var a=new c.Color(_5),x=a.toHsl();
20
if(x.s==0){
21
x.l=x.l<50?100:0;
22
}else{
23
x.s=_1;
24
if(x.l<_3){
25
x.l=_2;
26
}else{
27
if(x.l>_2){
28
x.l=_3;
29
}else{
30
x.l=x.l-_3>_2-x.l?_3:_2;
31
}
32
}
33
}
34
return c.fromHsl(x);
35
};
36
dojo.declare("dojox.charting.action2d.Highlight",dojox.charting.action2d.Base,{defaultParams:{duration:400,easing:dojo.fx.easing.backOut},optionalParams:{highlight:"red"},constructor:function(_6,_7,_8){
37
var a=_8&&_8.highlight;
38
this.colorFun=a?(dojo.isFunction(a)?a:cc(a)):hl;
39
this.connect();
40
},process:function(o){
41
if(!o.shape||!(o.type in this.overOutEvents)){
42
return;
43
}
44
var _9=o.run.name,_a=o.index,_b,_c,_d;
45
if(_9 in this.anim){
46
_b=this.anim[_9][_a];
47
}else{
48
this.anim[_9]={};
49
}
50
if(_b){
51
_b.action.stop(true);
52
}else{
53
var _e=o.shape.getFill();
54
if(!_e||!(_e instanceof dojo.Color)){
55
return;
56
}
57
this.anim[_9][_a]=_b={start:_e,end:this.colorFun(_e)};
58
}
59
var _f=_b.start,end=_b.end;
60
if(o.type=="onmouseout"){
61
var t=_f;
62
_f=end;
63
end=t;
64
}
65
_b.action=dojox.gfx.fx.animateFill({shape:o.shape,duration:this.duration,easing:this.easing,color:{start:_f,end:end}});
66
if(o.type=="onmouseout"){
67
dojo.connect(_b.action,"onEnd",this,function(){
68
if(this.anim[_9]){
69
delete this.anim[_9][_a];
70
}
71
});
72
}
73
_b.action.play();
74
}});
75
})();
76
}