1 | define(["dojo/_base/declare", "dojo/_base/Color"], function(declare, Color){ |
---|
2 | return declare("dojox.dgauges.components.DefaultPropertiesMixin", null, { |
---|
3 | // summary: |
---|
4 | // This class defines default properties of predefined gauges. |
---|
5 | |
---|
6 | // minimum: Number |
---|
7 | // The minimum value of the scaler. Default is 0. |
---|
8 | minimum: 0, |
---|
9 | // maximum: Number |
---|
10 | // The maximum value of the scaler. Default is 100. |
---|
11 | maximum: 100, |
---|
12 | // snapInterval: |
---|
13 | // Specifies the increment value to be used as snap values on this scale |
---|
14 | // during user interaction. |
---|
15 | // Default is 1. |
---|
16 | snapInterval: 1, |
---|
17 | // majorTickInterval: Number |
---|
18 | // The interval between two major ticks. |
---|
19 | majorTickInterval: NaN, |
---|
20 | // minorTickInterval: Number |
---|
21 | // The interval between two minor ticks. |
---|
22 | minorTickInterval: NaN, |
---|
23 | // minorTicksEnabled: Boolean |
---|
24 | // If false, minor ticks are not generated. Default is true. |
---|
25 | minorTicksEnabled: true, |
---|
26 | |
---|
27 | // summary: |
---|
28 | // The value of the indicator. Default is 0. |
---|
29 | value: 0, |
---|
30 | |
---|
31 | // interactionArea: String |
---|
32 | // How to interact with the indicator using mouse or touch interactions. |
---|
33 | // Can be "indicator", "gauge" or "none". The default value is "gauge". |
---|
34 | // If set to "indicator", the indicator shape reacts to mouse and touch events. |
---|
35 | // If set to "gauge", the whole gauge reacts to mouse and touch events. |
---|
36 | // If "none", interactions are disabled. |
---|
37 | interactionArea: "gauge", |
---|
38 | |
---|
39 | // interactionMode: String |
---|
40 | // Can be "mouse" or "touch". |
---|
41 | interactionMode: "mouse", |
---|
42 | |
---|
43 | // animationDuration: Number |
---|
44 | // The duration of the value change animation in milliseconds. Default is 0. |
---|
45 | // The animation occurs on both user interactions and programmatic value changes. |
---|
46 | // Set this property to 0 to disable animation. |
---|
47 | animationDuration: 0, |
---|
48 | |
---|
49 | _setMinimumAttr: function(v){ |
---|
50 | this.getElement("scale").scaler.set("minimum", v); |
---|
51 | }, |
---|
52 | _setMaximumAttr: function(v){ |
---|
53 | this.getElement("scale").scaler.set("maximum", v); |
---|
54 | }, |
---|
55 | _setSnapIntervalAttr: function(v){ |
---|
56 | this.getElement("scale").scaler.set("snapInterval", v); |
---|
57 | }, |
---|
58 | _setMajorTickIntervalAttr: function(v){ |
---|
59 | this.getElement("scale").scaler.set("majorTickInterval", v); |
---|
60 | }, |
---|
61 | _setMinorTickIntervalAttr: function(v){ |
---|
62 | this.getElement("scale").scaler.set("minorTickInterval", v); |
---|
63 | }, |
---|
64 | _setMinorTicksEnabledAttr: function(v){ |
---|
65 | this.getElement("scale").scaler.set("minorTicksEnabled", v); |
---|
66 | }, |
---|
67 | _setInteractionAreaAttr: function(v){ |
---|
68 | this.getElement("scale").getIndicator("indicator").set("interactionArea", v); |
---|
69 | }, |
---|
70 | _setInteractionModeAttr: function(v){ |
---|
71 | this.getElement("scale").getIndicator("indicator").set("interactionMode", v); |
---|
72 | }, |
---|
73 | _setAnimationDurationAttr: function(v){ |
---|
74 | this.getElement("scale").getIndicator("indicator").set("animationDuration", v); |
---|
75 | }, |
---|
76 | _setBorderColorAttr: function(v){ |
---|
77 | this.borderColor = new Color(v); |
---|
78 | this.invalidateRendering(); |
---|
79 | }, |
---|
80 | _setFillColorAttr: function(v){ |
---|
81 | this.fillColor = new Color(v); |
---|
82 | this.invalidateRendering(); |
---|
83 | }, |
---|
84 | _setIndicatorColorAttr: function(v){ |
---|
85 | this.indicatorColor = new Color(v); |
---|
86 | this.invalidateRendering(); |
---|
87 | } |
---|
88 | }); |
---|
89 | }); |
---|