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