defaults.js 6.1 KB

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