source: Dev/trunk/src/client/dojox/drawing/defaults.js @ 529

Last change on this file since 529 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

  • Property svn:executable set to *
File size: 5.9 KB
Line 
1define({
2        // summary:
3        //              Styles and defaults used for Drawing stencils and text.
4        // description:
5        //              This object contains defaults for objects used in Drawing.
6        //              To change one item's style, use item.attr();
7        //              To change all these styles, create a copy of this file
8        //              and point to it in the Drawing properties:
9        //              |       <div dojoType="dojox.drawing.Drawing" id="drawing" defaults="MyCustom.defaults"></div>
10        //
11        //              See: Drawing.changeDefaults
12
13        // clickMode: Boolean
14        //              Determines whether in draw or edit mode (whether stencils
15        //              are clickable.  If clickMode is false, the original
16        //              functionality of silently switching between select modes
17        //              is enabled.  If clickMode is true, it allows powerpoint-
18        //              like functionality.  Clickable is used by powerpoint to
19        //              distinguish when things can be selected and when they can't
20        clickMode:true,
21
22        clickable:true,
23
24        // current: Object
25        //       current will point to either null or selected
26        current:null,
27        // currentHit: Object
28        //              currentHit will point to either hitNorm or hitSelected
29        currentHit:null,
30
31        // angleSnap: Number
32        //              Line, arrows, vector and axes will all snap to this angle on mouse up
33        //              shown angle also reflects the snap
34        //              currently cannot accept less than 1 degree
35        angleSnap:1,
36
37        // zAxis:  Boolean
38    //          If true, draw current object in z-direction.
39        // zAxisEnabled: Boolean
40    //          If true, render axes with Z-axis included, allow objects drawn in z-direction.
41        //              If false the z-axis button will not show up.
42        zAxis: false,
43        zAxisEnabled: true,
44        zAngle: 225,
45       
46        // renderHitLines: Boolean
47        //              If true, renders a second, larger layer for lines to make
48        //              them more easily clickable.
49        renderHitLines: true,
50
51        // renderHitLayer:
52        //              If true, renders a second layer for each Stencil, one
53        //              acting as a 'hit' object for a wider mouse-click area.
54        //              It also doubles as a hilight. If true, overrides
55        //              renderHitLines setting.
56        renderHitLayer:true,
57
58        // labelSameColor:
59        //              If true, the label text color will be the same as the
60        //              Stencil's line color.
61        labelSameColor:false,
62
63        useSelectedStyle: true,
64
65        norm:{
66                // summary:
67                //              Normal style of all shapes
68                //              will get overridden by
69                //              above andes styles
70                width:1,
71                color:"#000000",
72                style:"Solid",
73                cap:"round", // square, butt, round
74                fill:"#CCCCCC"
75        },
76
77        selected:{
78                // summary:
79                //              Selected style of all shapes
80                //              styles not shown will used from
81                //      norm
82                width:6,
83                color:"#00FF00"
84        },
85
86        highlighted:{
87                // summary:
88                //              Highlighted style of all shapes
89                //              NOT CURRENTLY BEING USED
90                width:6,
91                color:"#FF00FF",
92                style:"Solid",
93                cap:"round",
94                fill:"#E11EBB"
95        },
96
97        disabled:{
98                // summary:
99                //              Disabled or "locked" or "fade" style of all shapes
100                width:1,
101                color:"#666666",
102                style:"solid",
103                cap:"round",
104                fill:"#cccccc"
105        },
106
107        // "hit" refers to the hidden object below the shape
108        // that is usually larger than the object to give a
109        // larger 'target' to click upon. These hit objects
110        // double as highlights.
111        hitNorm:{
112                // summary:
113                //              Normal style of a hit area
114                width:6,
115                color:{r:0, g:255, b:255, a:0},
116                style:"Solid",
117                cap:"round",
118                fill:{r:255, g:255, b:255, a:0}
119        },
120        hitSelected:{
121                // summary:
122                //              Selected style of a hit area
123                width:6,
124                color:"#FF9900",
125                style:"Solid",
126                cap:"round",
127                fill:{r:255, g:255, b:255, a:0}
128        },
129        hitHighlighted:{
130                // summary:
131                //              Highlighted style of a hit area
132                width:6,
133                color:"#FFFF00",
134                style:"Solid",
135                cap:"round",
136                fill:{r:255, g:255, b:255, a:0}
137        },
138
139
140        anchors:{
141                // summary:
142                //              Style for the anchor resize-points
143                size:10,
144                width:2,
145                color:"#999",
146                style:"solid",
147                fill:"#fff",
148                cap:"square",
149                minSize:10,
150                marginZero:5 // not really an anchor prop
151        },
152        arrows:{
153                // summary:
154                //              Size of arrows on vectors.
155                //              length is in pixels
156                //              width is actually an angle
157                //              but is close to pixels in size
158                length:30,
159                width:16
160        },
161        text:{
162                // summary:
163                //              Style of text
164                minWidth:100,
165                deleteEmptyCreate:true,
166                deleteEmptyModify:true,
167                pad:3,
168                size:"18px",
169                family:"sans-serif",
170                weight:"normal",
171                color:"#000000"
172        },
173        textDisabled:{
174                // summary:
175                //              Style of disabled text
176                size:"18px",
177                family:"sans-serif",
178                weight:"normal",
179                color:"#cccccc"
180        },
181
182        textMode:{
183                // summary:
184                //              These styles apply to the containing
185                //              text box (edit mode), and not the text itself
186                create:{
187                        width:2,
188                        style:"dotted",
189                        color:"#666666",
190                        fill:null
191                },
192                edit:{
193                        width:1,
194                        style:"dashed",
195                        color:"#666",
196                        fill:null
197                }
198
199        },
200
201        button:{
202                norm:{
203                        "color": "#cccccc",
204                        "fill": {
205                                type:"linear",
206                                x1:0, x2:0, y1:0, y2:100,
207                                colors:[
208                                        {offset:.5, color:"#ffffff"},
209                                        {offset:1, color:"#e5e5e5"}
210                                ]
211                        }
212                },
213                over:{
214                        "fill": {
215                                type:"linear",
216                                x1:0, x2:0, y1:0, y2:100,
217                                colors:[{offset:.5, color:"#ffffff"}, {offset:1, color:"#e1eaf5"}]
218                        },
219                        "color": "#92a0b3"
220                },
221                down:{
222                        "fill": {
223                                type:"linear",
224                                x1:0, x2:0, y1:0, y2:100,
225                                colors:[{offset:0, color:"#e1eaf5"}, {offset:1, color:"#ffffff"}]
226                        },
227                        "color": "#92a0b3"
228                },
229                selected:{
230                        "fill": {
231                                type:"linear",
232                                x1:0, x2:0, y1:0, y2:100,
233                                colors:[{offset:0, color:"#97b4bf"}, {offset:1, color:"#c8dae1"}]
234                        },
235                        "color": "#92a0b3"
236                },
237                icon:{
238                        norm:{
239                                fill:null,
240                                color:"#92a0b3"
241                        },
242                        selected:{
243                                fill:"#ffffff",
244                                color:"#92a0b3"
245                        }
246                }
247        },
248
249        copy: function(){
250                // summary:
251                //              Each shape gets its own copy
252                //              of these styles so that instances
253                //              do not change each other's styles
254
255                var cpy = function(obj){
256                                if(typeof(obj)!="object" || obj===null || obj===undefined){
257                                        return obj;
258                                }
259                                var o;
260                                if(obj.push){
261                                        o = [];
262                                        for(var i=0; i<obj.length;i++){
263                                                o.push(cpy(obj[i]))
264                                        }
265                                        return o;
266                                }
267                        o = {};
268                        for(var nm in obj){
269                                if(nm!="copy"){
270                                        if(typeof(obj[nm])=="object"){
271                                                o[nm] = cpy(obj[nm]);
272                                        }else{
273                                                o[nm] = obj[nm]
274                                        }
275                                }
276                        }
277                        return o;
278                };
279                var o = cpy(this);
280                o.current = o.norm;
281                o.currentHit = o.hitNorm;
282                o.currentText = o.text;
283                return o;
284        }
285
286});
Note: See TracBrowser for help on using the repository browser.