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