1 | define(["dojo/_base/connect", "dojo/_base/declare", "./Base", "dojo/fx/easing", "dojox/lang/functional"], |
---|
2 | function(hub, declare, Base, dfe, df){ |
---|
3 | |
---|
4 | /*===== |
---|
5 | var __PlotActionCtorArgs = { |
---|
6 | // summary: |
---|
7 | // The base keyword arguments object for creating an action2d. |
---|
8 | // duration: Number? |
---|
9 | // The amount of time in milliseconds for an animation to last. Default is 400. |
---|
10 | // easing: dojo/fx/easing/*? |
---|
11 | // An easing object (see dojo.fx.easing) for use in an animation. The |
---|
12 | // default is dojo.fx.easing.backOut. |
---|
13 | }; |
---|
14 | =====*/ |
---|
15 | |
---|
16 | var DEFAULT_DURATION = 400, // ms |
---|
17 | DEFAULT_EASING = dfe.backOut; |
---|
18 | |
---|
19 | return declare("dojox.charting.action2d.PlotAction", Base, { |
---|
20 | // summary: |
---|
21 | // Base action class for plot actions. |
---|
22 | |
---|
23 | overOutEvents: {onmouseover: 1, onmouseout: 1}, |
---|
24 | |
---|
25 | constructor: function(chart, plot, kwargs){ |
---|
26 | // summary: |
---|
27 | // Create a new base PlotAction. |
---|
28 | // chart: dojox/charting/Chart |
---|
29 | // The chart this action applies to. |
---|
30 | // plot: String? |
---|
31 | // The name of the plot this action belongs to. If none is passed "default" is assumed. |
---|
32 | // kwargs: __PlotActionCtorArgs? |
---|
33 | // Optional arguments for the action. |
---|
34 | this.anim = {}; |
---|
35 | |
---|
36 | // process common optional named parameters |
---|
37 | if(!kwargs){ kwargs = {}; } |
---|
38 | this.duration = kwargs.duration ? kwargs.duration : DEFAULT_DURATION; |
---|
39 | this.easing = kwargs.easing ? kwargs.easing : DEFAULT_EASING; |
---|
40 | }, |
---|
41 | |
---|
42 | connect: function(){ |
---|
43 | // summary: |
---|
44 | // Connect this action to the given plot. |
---|
45 | this.handle = this.chart.connectToPlot(this.plot.name, this, "process"); |
---|
46 | }, |
---|
47 | |
---|
48 | disconnect: function(){ |
---|
49 | // summary: |
---|
50 | // Disconnect this action from the given plot, if connected. |
---|
51 | if(this.handle){ |
---|
52 | hub.disconnect(this.handle); |
---|
53 | this.handle = null; |
---|
54 | } |
---|
55 | }, |
---|
56 | |
---|
57 | reset: function(){ |
---|
58 | // summary: |
---|
59 | // Reset the action. |
---|
60 | }, |
---|
61 | |
---|
62 | destroy: function(){ |
---|
63 | // summary: |
---|
64 | // Do any cleanup needed when destroying parent elements. |
---|
65 | this.inherited(arguments); |
---|
66 | df.forIn(this.anim, function(o){ |
---|
67 | df.forIn(o, function(anim){ |
---|
68 | anim.action.stop(true); |
---|
69 | }); |
---|
70 | }); |
---|
71 | this.anim = {}; |
---|
72 | } |
---|
73 | }); |
---|
74 | }); |
---|