mxMockupMisc.js 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
  1. /**
  2. * $Id: mxMockupMisc.js,v 1.5 2013/02/28 13:50:11 mate Exp $
  3. * Copyright (c) 2006-2010, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Playback Controls
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeMockupPlaybackControls(bounds, fill, stroke, strokewidth)
  12. {
  13. mxShape.call(this);
  14. this.bounds = bounds;
  15. this.fill = fill;
  16. this.stroke = stroke;
  17. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  18. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxShapeMockupPlaybackControls, mxShape);
  23. mxShapeMockupPlaybackControls.prototype.cst = {
  24. SHAPE_PLAYBACK_CONTROLS : 'mxgraph.mockup.misc.playbackControls',
  25. FILL_COLOR2 : 'fillColor2',
  26. STROKE_COLOR2 : 'strokeColor2',
  27. FILL_COLOR3 : 'fillColor3',
  28. STROKE_COLOR3 : 'strokeColor3'
  29. };
  30. mxShapeMockupPlaybackControls.prototype.customProperties = [
  31. {name: 'fillColor2', dispName: 'Outline Color', type: 'color'},
  32. {name: 'fillColor3', dispName: 'Symbol Color', type: 'color'},
  33. {name: 'strokeColor2', dispName: 'Outline Stroke Color', type: 'color'},
  34. {name: 'strokeColor3', dispName: 'Symbol Stroke Color', type: 'color'}
  35. ];
  36. /**
  37. * Function: paintVertexShape
  38. *
  39. * Paints the vertex shape.
  40. */
  41. mxShapeMockupPlaybackControls.prototype.paintVertexShape = function(c, x, y, w, h)
  42. {
  43. var controlBarHeight = 30;
  44. var buttonSize = 22;
  45. var h = Math.max(h, controlBarHeight);
  46. var w = Math.max(225, w);
  47. c.translate(x, y);
  48. this.background(c, w, h, controlBarHeight);
  49. c.setShadow(false);
  50. this.foreground(c, w, h, controlBarHeight, buttonSize);
  51. };
  52. mxShapeMockupPlaybackControls.prototype.background = function(c, w, h, controlBarHeight)
  53. {
  54. c.rect(0, (h - controlBarHeight) * 0.5, w, controlBarHeight);
  55. c.fillAndStroke();
  56. }
  57. mxShapeMockupPlaybackControls.prototype.foreground = function(c, w, h, controlBarHeight, buttonSize)
  58. {
  59. var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.FILL_COLOR2, '#99ddff');
  60. var strokeColor2 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.STROKE_COLOR2, 'none');
  61. var fillColor3 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.FILL_COLOR3, '#ffffff');
  62. var strokeColor3 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.STROKE_COLOR3, 'none');
  63. c.setStrokeColor(strokeColor2);
  64. c.setFillColor(fillColor2);
  65. c.ellipse(10, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  66. c.fillAndStroke();
  67. c.ellipse(40, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  68. c.fillAndStroke();
  69. c.ellipse(70, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  70. c.fillAndStroke();
  71. c.ellipse(100, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  72. c.fillAndStroke();
  73. c.ellipse(130, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  74. c.fillAndStroke();
  75. c.ellipse(160, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  76. c.fillAndStroke();
  77. c.ellipse(190, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
  78. c.fillAndStroke();
  79. c.setStrokeColor(strokeColor3);
  80. c.setFillColor(fillColor3);
  81. // start
  82. var t = h * 0.5 - controlBarHeight * 0.5;
  83. c.begin();
  84. c.moveTo(16, t + 10);
  85. c.lineTo(16, t + 20);
  86. c.lineTo(18, t + 20);
  87. c.lineTo(18, t + 10);
  88. c.close();
  89. c.moveTo(20, t + 15);
  90. c.lineTo(25, t + 20);
  91. c.lineTo(25, t + 10);
  92. c.close();
  93. c.fillAndStroke();
  94. // rewind
  95. c.begin();
  96. c.moveTo(44, t + 15);
  97. c.lineTo(49, t + 20);
  98. c.lineTo(49, t + 10);
  99. c.close();
  100. c.moveTo(51, t + 15);
  101. c.lineTo(56, t + 20);
  102. c.lineTo(56, t + 10);
  103. c.close();
  104. c.fillAndStroke();
  105. // back
  106. c.begin();
  107. c.moveTo(77, t + 15);
  108. c.lineTo(82, t + 20);
  109. c.lineTo(82, t + 10);
  110. c.close();
  111. c.fillAndStroke();
  112. // play/pause
  113. c.begin();
  114. c.moveTo(108, t + 10);
  115. c.lineTo(108, t + 20);
  116. c.lineTo(110, t + 20);
  117. c.lineTo(110, t + 10);
  118. c.close();
  119. c.moveTo(117, t + 15);
  120. c.lineTo(112, t + 20);
  121. c.lineTo(112, t + 10);
  122. c.close();
  123. c.fillAndStroke();
  124. // forward
  125. c.begin();
  126. c.moveTo(144, t + 15);
  127. c.lineTo(139, t + 20);
  128. c.lineTo(139, t + 10);
  129. c.close();
  130. c.fillAndStroke();
  131. // fast forward
  132. c.begin();
  133. c.moveTo(171, t + 15);
  134. c.lineTo(166, t + 20);
  135. c.lineTo(166, t + 10);
  136. c.close();
  137. c.moveTo(178, t + 15);
  138. c.lineTo(173, t + 20);
  139. c.lineTo(173, t + 10);
  140. c.close();
  141. c.fillAndStroke();
  142. // end
  143. c.begin();
  144. c.moveTo(203, t + 10);
  145. c.lineTo(203, t + 20);
  146. c.lineTo(205, t + 20);
  147. c.lineTo(205, t + 10);
  148. c.close();
  149. c.moveTo(201, t + 15);
  150. c.lineTo(196, t + 20);
  151. c.lineTo(196, t + 10);
  152. c.close();
  153. c.fillAndStroke();
  154. };
  155. mxCellRenderer.registerShape(mxShapeMockupPlaybackControls.prototype.cst.SHAPE_PLAYBACK_CONTROLS, mxShapeMockupPlaybackControls);
  156. //**********************************************************************************************************************************************************
  157. //Progress Bar
  158. //**********************************************************************************************************************************************************
  159. /**
  160. * Extends mxShape.
  161. */
  162. function mxShapeMockupProgressBar(bounds, fill, stroke, strokewidth)
  163. {
  164. mxShape.call(this);
  165. this.bounds = bounds;
  166. this.fill = fill;
  167. this.stroke = stroke;
  168. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  169. this.barPos = 20;
  170. };
  171. /**
  172. * Extends mxShape.
  173. */
  174. mxUtils.extend(mxShapeMockupProgressBar, mxShape);
  175. mxShapeMockupProgressBar.prototype.cst = {
  176. SHAPE_PROGRESS_BAR : 'mxgraph.mockup.misc.progressBar',
  177. BAR_POS : 'barPos',
  178. FILL_COLOR2 : 'fillColor2'
  179. };
  180. mxShapeMockupProgressBar.prototype.customProperties = [
  181. {name: 'fillColor2', dispName: 'Outline Color', type: 'color'},
  182. {name: 'barPos', dispName: 'Handle Position', type: 'float', min:0, defVal:80}
  183. ];
  184. /**
  185. * Function: paintVertexShape
  186. *
  187. * Paints the vertex shape.
  188. */
  189. mxShapeMockupProgressBar.prototype.paintVertexShape = function(c, x, y, w, h)
  190. {
  191. c.translate(x, y);
  192. this.background(c, w, h);
  193. c.setShadow(false);
  194. this.foreground(c, w, h);
  195. };
  196. mxShapeMockupProgressBar.prototype.background = function(c, w, h)
  197. {
  198. c.roundrect(0, h * 0.5 - 5, w, 10, 5, 5);
  199. c.fillAndStroke();
  200. };
  201. mxShapeMockupProgressBar.prototype.foreground = function(c, w, h)
  202. {
  203. var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupProgressBar.prototype.cst.FILL_COLOR2, '#ddeeff');
  204. var barPos = mxUtils.getValue(this.style, mxShapeMockupProgressBar.prototype.cst.BAR_POS, '80');
  205. barPos = Math.min(barPos, 100);
  206. barPos = Math.max(barPos, 0);
  207. var deadzone = 0;
  208. var virRange = w - 2 * deadzone;
  209. var truePos = deadzone + virRange * barPos / 100;
  210. c.setFillColor(fillColor2);
  211. c.roundrect(0, h * 0.5 - 5, truePos, 10, 5, 5);
  212. c.fillAndStroke();
  213. };
  214. mxCellRenderer.registerShape(mxShapeMockupProgressBar.prototype.cst.SHAPE_PROGRESS_BAR, mxShapeMockupProgressBar);
  215. Graph.handleFactory[mxShapeMockupProgressBar.prototype.cst.SHAPE_PROGRESS_BAR] = function(state)
  216. {
  217. var handles = [Graph.createHandle(state, ['barPos'], function(bounds)
  218. {
  219. var barPos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'barPos', this.barPos))));
  220. return new mxPoint(bounds.x + barPos * bounds.width / 100, bounds.y + bounds.height * 0.5);
  221. }, function(bounds, pt)
  222. {
  223. this.state.style['barPos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
  224. })];
  225. return handles;
  226. }
  227. //**********************************************************************************************************************************************************
  228. //Shopping Cart
  229. //**********************************************************************************************************************************************************
  230. /**
  231. * Extends mxShape.
  232. */
  233. function mxShapeMockupShoppingCart(bounds, fill, stroke, strokewidth)
  234. {
  235. mxShape.call(this);
  236. this.bounds = bounds;
  237. this.fill = fill;
  238. this.stroke = stroke;
  239. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  240. };
  241. /**
  242. * Extends mxShape.
  243. */
  244. mxUtils.extend(mxShapeMockupShoppingCart, mxShape);
  245. mxShapeMockupShoppingCart.prototype.cst = {
  246. SHAPE_SHOPPING_CART : 'mxgraph.mockup.misc.shoppingCart'
  247. };
  248. /**
  249. * Function: paintVertexShape
  250. *
  251. * Paints the vertex shape.
  252. */
  253. mxShapeMockupShoppingCart.prototype.paintVertexShape = function(c, x, y, w, h)
  254. {
  255. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  256. c.translate(x, y);
  257. c.setStrokeWidth(3);
  258. c.begin();
  259. c.moveTo(w * 0.975, h * 0.025);
  260. c.lineTo(w * 0.82, h * 0.055);
  261. c.lineTo(w * 0.59, h * 0.66);
  262. c.lineTo(w * 0.7, h * 0.765);
  263. c.arcTo(w * 0.06, h * 0.06, 0, 0, 1, w * 0.665, h * 0.86);
  264. c.lineTo(w * 0.05, h * 0.86);
  265. c.moveTo(w * 0.74, h * 0.26);
  266. c.lineTo(w * 0.03, h * 0.28);
  267. c.lineTo(w * 0.065, h * 0.61);
  268. c.lineTo(w * 0.59, h * 0.66);
  269. c.stroke();
  270. c.setStrokeWidth(1);
  271. c.begin();
  272. c.moveTo(w * 0.15, h * 0.28);
  273. c.lineTo(w * 0.15, h * 0.62);
  274. c.moveTo(w * 0.265, h * 0.275);
  275. c.lineTo(w * 0.265, h * 0.63);
  276. c.moveTo(w * 0.38, h * 0.27);
  277. c.lineTo(w * 0.38, h * 0.64);
  278. c.moveTo(w * 0.495, h * 0.265);
  279. c.lineTo(w * 0.495, h * 0.65);
  280. c.moveTo(w * 0.61, h * 0.265);
  281. c.lineTo(w * 0.61, h * 0.61);
  282. c.stroke();
  283. c.begin();
  284. c.moveTo(w * 0.69, h * 0.405);
  285. c.lineTo(w * 0.045, h * 0.405);
  286. c.moveTo(w * 0.645, h * 0.52);
  287. c.lineTo(w * 0.055, h * 0.52);
  288. c.stroke();
  289. c.setFillColor(strokeColor);
  290. c.ellipse(w * 0.075, h * 0.89, w * 0.1, h * 0.1);
  291. c.fillAndStroke();
  292. c.ellipse(w * 0.62, h * 0.89, w * 0.1, h * 0.1);
  293. c.fillAndStroke();
  294. };
  295. mxCellRenderer.registerShape(mxShapeMockupShoppingCart.prototype.cst.SHAPE_SHOPPING_CART, mxShapeMockupShoppingCart);
  296. //**********************************************************************************************************************************************************
  297. //Rating
  298. //**********************************************************************************************************************************************************
  299. /**
  300. * Extends mxShape.
  301. */
  302. function mxShapeMockupRating(bounds, fill, stroke, strokewidth)
  303. {
  304. mxShape.call(this);
  305. this.bounds = bounds;
  306. this.fill = fill;
  307. this.stroke = stroke;
  308. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  309. };
  310. /**
  311. * Extends mxShape.
  312. */
  313. mxUtils.extend(mxShapeMockupRating, mxShape);
  314. mxShapeMockupRating.prototype.cst = {
  315. SHAPE_RATING : 'mxgraph.mockup.misc.rating',
  316. RATING_STYLE : 'ratingStyle',
  317. RATING_SCALE : 'ratingScale',
  318. RATING_HEART : 'heart',
  319. RATING_STAR : 'star',
  320. EMPTY_FILL_COLOR : 'emptyFillColor',
  321. GRADE : 'grade'
  322. };
  323. mxShapeMockupRating.prototype.customProperties = [
  324. {name: 'ratingStyle', dispName: 'Style', type: 'enum',
  325. enumList: [{val: 'heart', dispName: 'Heart'}, {val: 'star', dispName: 'Star'}]
  326. },
  327. {name: 'ratingScale', dispName: 'Max. Rating', type: 'int'},
  328. {name: 'grade', dispName: 'Current Rating', type: 'int'},
  329. {name: 'emptyFillColor', dispName: 'Fill2 Color', type: 'color'}
  330. ];
  331. /**
  332. * Function: paintVertexShape
  333. *
  334. * Paints the vertex shape.
  335. */
  336. mxShapeMockupRating.prototype.paintVertexShape = function(c, x, y, w, h)
  337. {
  338. var ratingStyle = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.RATING_STYLE, mxShapeMockupRating.prototype.cst.RATING_STAR);
  339. var grade = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.GRADE, '5');
  340. var ratingScale = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.RATING_SCALE, '10');
  341. c.translate(x, y);
  342. if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_STAR)
  343. {
  344. for (var i = 0; i < grade; i++)
  345. {
  346. c.begin();
  347. c.moveTo(i * h * 1.5, 0.33 * h);
  348. c.lineTo(i * h * 1.5 + 0.364 * h, 0.33 * h);
  349. c.lineTo(i * h * 1.5 + 0.475 * h, 0);
  350. c.lineTo(i * h * 1.5 + 0.586 * h, 0.33 * h);
  351. c.lineTo(i * h * 1.5 + 0.95 * h, 0.33 * h);
  352. c.lineTo(i * h * 1.5 + 0.66 * h, 0.551 * h);
  353. c.lineTo(i * h * 1.5 + 0.775 * h, 0.9 * h);
  354. c.lineTo(i * h * 1.5 + 0.475 * h, 0.684 * h);
  355. c.lineTo(i * h * 1.5 + 0.175 * h, 0.9 * h);
  356. c.lineTo(i * h * 1.5 + 0.29 * h, 0.551 * h);
  357. c.close();
  358. c.fillAndStroke();
  359. }
  360. }
  361. else if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_HEART)
  362. {
  363. for (var i = 0; i < grade; i++)
  364. {
  365. c.begin();
  366. c.moveTo(i * h * 1.5 + h * 0.519, h * 0.947);
  367. c.curveTo(i * h * 1.5 + h * 0.558, h * 0.908, i * h * 1.5 + h * 0.778, h * 0.682, i * h * 1.5 + h * 0.916, h * 0.54);
  368. c.curveTo(i * h * 1.5 + h * 1.039, h * 0.414, i * h * 1.5 + h * 1.036, h * 0.229, i * h * 1.5 + h * 0.924, h * 0.115);
  369. c.curveTo(i * h * 1.5 + h * 0.812, 0, i * h * 1.5 + h * 0.631, 0, i * h * 1.5 + h * 0.519, h * 0.115);
  370. c.curveTo(i * h * 1.5 + h * 0.408, 0, i * h * 1.5 + h * 0.227, 0, i * h * 1.5 + h * 0.115, h * 0.115);
  371. c.curveTo(i * h * 1.5 + h * 0.03, h * 0.229, i * h * 1.5, h * 0.414, i * h * 1.5 + h * 0.123, h * 0.54);
  372. c.close();
  373. c.fillAndStroke();
  374. }
  375. }
  376. var emptyFillColor = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.EMPTY_FILL_COLOR, '#ffffff');
  377. c.setFillColor(emptyFillColor);
  378. if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_STAR)
  379. {
  380. for (var i = grade; i < ratingScale; i++)
  381. {
  382. c.begin();
  383. c.moveTo(i * h * 1.5, 0.33 * h);
  384. c.lineTo(i * h * 1.5 + 0.364 * h, 0.33 * h);
  385. c.lineTo(i * h * 1.5 + 0.475 * h, 0);
  386. c.lineTo(i * h * 1.5 + 0.586 * h, 0.33 * h);
  387. c.lineTo(i * h * 1.5 + 0.95 * h, 0.33 * h);
  388. c.lineTo(i * h * 1.5 + 0.66 * h, 0.551 * h);
  389. c.lineTo(i * h * 1.5 + 0.775 * h, 0.9 * h);
  390. c.lineTo(i * h * 1.5 + 0.475 * h, 0.684 * h);
  391. c.lineTo(i * h * 1.5 + 0.175 * h, 0.9 * h);
  392. c.lineTo(i * h * 1.5 + 0.29 * h, 0.551 * h);
  393. c.close();
  394. c.fillAndStroke();
  395. }
  396. }
  397. else if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_HEART)
  398. {
  399. for (var i = grade; i < ratingScale; i++)
  400. {
  401. c.begin();
  402. c.moveTo(i * h * 1.5 + h * 0.519, h * 0.947);
  403. c.curveTo(i * h * 1.5 + h * 0.558, h * 0.908, i * h * 1.5 + h * 0.778, h * 0.682, i * h * 1.5 + h * 0.916, h * 0.54);
  404. c.curveTo(i * h * 1.5 + h * 1.039, h * 0.414, i * h * 1.5 + h * 1.036, h * 0.229, i * h * 1.5 + h * 0.924, h * 0.115);
  405. c.curveTo(i * h * 1.5 + h * 0.812, 0, i * h * 1.5 + h * 0.631, 0, i * h * 1.5 + h * 0.519, h * 0.115);
  406. c.curveTo(i * h * 1.5 + h * 0.408, 0, i * h * 1.5 + h * 0.227, 0, i * h * 1.5 + h * 0.115, h * 0.115);
  407. c.curveTo(i * h * 1.5 + h * 0.03, h * 0.229, i * h * 1.5, h * 0.414, i * h * 1.5 + h * 0.123, h * 0.54);
  408. c.close();
  409. c.fillAndStroke();
  410. }
  411. }
  412. };
  413. mxCellRenderer.registerShape(mxShapeMockupRating.prototype.cst.SHAPE_RATING, mxShapeMockupRating);
  414. //**********************************************************************************************************************************************************
  415. //Mail
  416. //**********************************************************************************************************************************************************
  417. /**
  418. * Extends mxShape.
  419. */
  420. function mxShapeMockupMail(bounds, fill, stroke, strokewidth)
  421. {
  422. mxShape.call(this);
  423. this.bounds = bounds;
  424. this.fill = fill;
  425. this.stroke = stroke;
  426. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  427. };
  428. /**
  429. * Extends mxShape.
  430. */
  431. mxUtils.extend(mxShapeMockupMail, mxShape);
  432. mxShapeMockupMail.prototype.cst = {
  433. SHAPE_MAIL : 'mxgraph.mockup.misc.mail2'
  434. };
  435. /**
  436. * Function: paintVertexShape
  437. *
  438. * Paints the vertex shape.
  439. */
  440. mxShapeMockupMail.prototype.paintVertexShape = function(c, x, y, w, h)
  441. {
  442. c.translate(x, y);
  443. c.rect(0, 0, w, h);
  444. c.fillAndStroke();
  445. c.setShadow(false);
  446. c.begin();
  447. c.moveTo(0, 0);
  448. c.lineTo(w * 0.5, h * 0.5);
  449. c.lineTo(w, 0);
  450. c.stroke();
  451. };
  452. mxCellRenderer.registerShape(mxShapeMockupMail.prototype.cst.SHAPE_MAIL, mxShapeMockupMail);
  453. //**********************************************************************************************************************************************************
  454. //Volume Slider
  455. //**********************************************************************************************************************************************************
  456. /**
  457. * Extends mxShape.
  458. */
  459. function mxShapeMockupVolumeSlider(bounds, fill, stroke, strokewidth)
  460. {
  461. mxShape.call(this);
  462. this.bounds = bounds;
  463. this.fill = fill;
  464. this.stroke = stroke;
  465. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  466. this.barPos = 80;
  467. };
  468. /**
  469. * Extends mxShape.
  470. */
  471. mxUtils.extend(mxShapeMockupVolumeSlider, mxShape);
  472. mxShapeMockupVolumeSlider.prototype.cst = {
  473. SHAPE_VOLUME_SLIDER : 'mxgraph.mockup.misc.volumeSlider',
  474. BAR_POS : 'barPos',
  475. FILL_COLOR2 : 'fillColor2'
  476. };
  477. mxShapeMockupVolumeSlider.prototype.customProperties = [
  478. {name: 'fillColor2', dispName: 'Fill2 Color', type: 'color'},
  479. {name: 'barPos', dispName: 'Handle Position', type: 'float'}
  480. ];
  481. /**
  482. * Function: paintVertexShape
  483. *
  484. * Paints the vertex shape.
  485. */
  486. mxShapeMockupVolumeSlider.prototype.paintVertexShape = function(c, x, y, w, h)
  487. {
  488. c.translate(x, y);
  489. var barPos = mxUtils.getValue(this.style, mxShapeMockupVolumeSlider.prototype.cst.BAR_POS, '80');
  490. var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupVolumeSlider.prototype.cst.FILL_COLOR2, '#ddeeff');
  491. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  492. //only the progress bar handle needs to be drawn
  493. barPos = Math.min(barPos, 100);
  494. barPos = Math.max(barPos, 0);
  495. var controlBarHeight = 25;
  496. var h = Math.max(h, controlBarHeight);
  497. var w = Math.max(w, 3.5 * controlBarHeight);
  498. var speakerStartX = w - controlBarHeight;
  499. var speakerStartY = (h - controlBarHeight) * 0.5;
  500. c.begin();
  501. c.moveTo(speakerStartX + controlBarHeight * 0.05, speakerStartY + controlBarHeight * 0.35);
  502. c.lineTo(speakerStartX + controlBarHeight * 0.15, speakerStartY + controlBarHeight * 0.35);
  503. c.lineTo(speakerStartX + controlBarHeight * 0.3, speakerStartY + controlBarHeight * 0.2);
  504. c.lineTo(speakerStartX + controlBarHeight * 0.3, speakerStartY + controlBarHeight * 0.8);
  505. c.lineTo(speakerStartX + controlBarHeight * 0.15, speakerStartY + controlBarHeight * 0.65);
  506. c.lineTo(speakerStartX + controlBarHeight * 0.05, speakerStartY + controlBarHeight * 0.65);
  507. c.close();
  508. c.fill();
  509. //draw the handle based on barPos
  510. var barMin = 0;
  511. var barMax = w - controlBarHeight * 1.3;
  512. var videoBarStartY = (h - controlBarHeight) * 0.5;
  513. var barRange = barMax - barMin;
  514. var barPos = barRange * barPos / 100;
  515. var barEnd = barMin + barPos;
  516. var soundStartX = w - controlBarHeight;
  517. var soundStartY = (h - controlBarHeight) * 0.5;
  518. c.begin();
  519. c.moveTo(soundStartX + controlBarHeight * 0.4, soundStartY + controlBarHeight * 0.35);
  520. c.arcTo(controlBarHeight * 0.2, controlBarHeight * 0.3, 0, 0, 1, soundStartX + controlBarHeight * 0.4, soundStartY + controlBarHeight * 0.65);
  521. c.moveTo(soundStartX + controlBarHeight * 0.425, soundStartY + controlBarHeight * 0.25);
  522. c.arcTo(controlBarHeight * 0.225, controlBarHeight * 0.35, 0, 0, 1, soundStartX + controlBarHeight * 0.425, soundStartY + controlBarHeight * 0.75);
  523. c.moveTo(soundStartX + controlBarHeight * 0.5, soundStartY + controlBarHeight * 0.2);
  524. c.arcTo(controlBarHeight * 0.25, controlBarHeight * 0.4, 0, 0, 1, soundStartX + controlBarHeight * 0.5, soundStartY + controlBarHeight * 0.8);
  525. c.fillAndStroke();
  526. //now we draw the video progress bar
  527. var videoBarStartX = 0;
  528. var videoBarStartY = (h - controlBarHeight) * 0.5;
  529. var videoBarEndX = w - controlBarHeight * 1.3;
  530. c.roundrect(videoBarStartX, videoBarStartY + controlBarHeight * 0.35, videoBarEndX, controlBarHeight * 0.3, 5, 5);
  531. c.fill();
  532. c.setShadow(false);
  533. c.setFillColor(fillColor2);
  534. c.roundrect(barMin, videoBarStartY + controlBarHeight * 0.35, barEnd, controlBarHeight * 0.3, 5, 5);
  535. c.fill();
  536. c.ellipse(barEnd - controlBarHeight * 0.25, videoBarStartY + controlBarHeight * 0.25, controlBarHeight * 0.5, controlBarHeight * 0.5);
  537. c.fillAndStroke();
  538. };
  539. mxCellRenderer.registerShape(mxShapeMockupVolumeSlider.prototype.cst.SHAPE_VOLUME_SLIDER, mxShapeMockupVolumeSlider);
  540. Graph.handleFactory[mxShapeMockupVolumeSlider.prototype.cst.SHAPE_VOLUME_SLIDER] = function(state)
  541. {
  542. var handles = [Graph.createHandle(state, ['barPos'], function(bounds)
  543. {
  544. var barPos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'barPos', this.barPos))));
  545. return new mxPoint(bounds.x + barPos * (bounds.width - 32.5) / 100, bounds.y + bounds.height * 0.5);
  546. }, function(bounds, pt)
  547. {
  548. this.state.style['barPos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
  549. })];
  550. return handles;
  551. }
  552. //**********************************************************************************************************************************************************
  553. //Edit Icon
  554. //**********************************************************************************************************************************************************
  555. /**
  556. * Extends mxShape.
  557. */
  558. function mxShapeMockupEdit(bounds, fill, stroke, strokewidth)
  559. {
  560. mxShape.call(this);
  561. this.bounds = bounds;
  562. this.fill = fill;
  563. this.stroke = stroke;
  564. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  565. };
  566. /**
  567. * Extends mxShape.
  568. */
  569. mxUtils.extend(mxShapeMockupEdit, mxShape);
  570. mxShapeMockupEdit.prototype.cst = {
  571. SHAPE_EDIT : 'mxgraph.mockup.misc.editIcon'
  572. };
  573. /**
  574. * Function: paintVertexShape
  575. *
  576. * Paints the vertex shape.
  577. */
  578. mxShapeMockupEdit.prototype.paintVertexShape = function(c, x, y, w, h)
  579. {
  580. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  581. c.translate(x, y);
  582. c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
  583. c.fillAndStroke();
  584. c.setShadow(false);
  585. c.setFillColor(strokeColor);
  586. c.begin();
  587. c.moveTo(w * 0.11, h * 0.8);
  588. c.lineTo(w * 0.2, h * 0.89);
  589. c.lineTo(w * 0.05, h * 0.95);
  590. c.close();
  591. c.moveTo(w * 0.74, h * 0.16);
  592. c.lineTo(w * 0.84, h * 0.26);
  593. c.lineTo(w * 0.22, h * 0.88);
  594. c.lineTo(w * 0.12, h * 0.78);
  595. c.close();
  596. c.moveTo(w * 0.755, h * 0.145);
  597. c.lineTo(w * 0.82, h * 0.08);
  598. c.lineTo(w * 0.92, h * 0.18);
  599. c.lineTo(w * 0.855, h * 0.245);
  600. c.close();
  601. c.fill();
  602. };
  603. mxCellRenderer.registerShape(mxShapeMockupEdit.prototype.cst.SHAPE_EDIT, mxShapeMockupEdit);
  604. //**********************************************************************************************************************************************************
  605. //Print Icon
  606. //**********************************************************************************************************************************************************
  607. /**
  608. * Extends mxShape.
  609. */
  610. function mxShapeMockupPrint(bounds, fill, stroke, strokewidth)
  611. {
  612. mxShape.call(this);
  613. this.bounds = bounds;
  614. this.fill = fill;
  615. this.stroke = stroke;
  616. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  617. };
  618. /**
  619. * Extends mxShape.
  620. */
  621. mxUtils.extend(mxShapeMockupPrint, mxShape);
  622. mxShapeMockupPrint.prototype.cst = {
  623. SHAPE_PRINT : 'mxgraph.mockup.misc.printIcon'
  624. };
  625. /**
  626. * Function: paintVertexShape
  627. *
  628. * Paints the vertex shape.
  629. */
  630. mxShapeMockupPrint.prototype.paintVertexShape = function(c, x, y, w, h)
  631. {
  632. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  633. c.translate(x, y);
  634. c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
  635. c.fillAndStroke();
  636. c.setShadow(false);
  637. c.setFillColor(strokeColor);
  638. c.begin();
  639. c.moveTo(w * 0.15, h * 0.58);
  640. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.18, h * 0.55);
  641. c.lineTo(w * 0.82, h * 0.55);
  642. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.85, h * 0.58);
  643. c.lineTo(w * 0.85, h * 0.82);
  644. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.82, h * 0.85);
  645. c.lineTo(w * 0.18, h * 0.85);
  646. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.15, h * 0.82);
  647. c.close();
  648. c.moveTo(w * 0.7, h * 0.52);
  649. c.lineTo(w * 0.3, h * 0.52);
  650. c.lineTo(w * 0.3, h * 0.15);
  651. c.lineTo(w * 0.55, h * 0.15);
  652. c.lineTo(w * 0.55, h * 0.3);
  653. c.lineTo(w * 0.7, h * 0.3);
  654. c.close();
  655. c.moveTo(w * 0.57, h * 0.15);
  656. c.lineTo(w * 0.7, h * 0.28);
  657. c.lineTo(w * 0.57, h * 0.28);
  658. c.close();
  659. c.fill();
  660. };
  661. mxCellRenderer.registerShape(mxShapeMockupPrint.prototype.cst.SHAPE_PRINT, mxShapeMockupPrint);
  662. //**********************************************************************************************************************************************************
  663. //Print Icon
  664. //**********************************************************************************************************************************************************
  665. /**
  666. * Extends mxShape.
  667. */
  668. function mxShapeMockupShare(bounds, fill, stroke, strokewidth)
  669. {
  670. mxShape.call(this);
  671. this.bounds = bounds;
  672. this.fill = fill;
  673. this.stroke = stroke;
  674. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  675. };
  676. /**
  677. * Extends mxShape.
  678. */
  679. mxUtils.extend(mxShapeMockupShare, mxShape);
  680. mxShapeMockupShare.prototype.cst = {
  681. SHAPE_SHARE : 'mxgraph.mockup.misc.shareIcon'
  682. };
  683. /**
  684. * Function: paintVertexShape
  685. *
  686. * Paints the vertex shape.
  687. */
  688. mxShapeMockupShare.prototype.paintVertexShape = function(c, x, y, w, h)
  689. {
  690. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  691. c.translate(x, y);
  692. c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
  693. c.fillAndStroke();
  694. c.setShadow(false);
  695. c.setFillColor(strokeColor);
  696. c.begin();
  697. c.moveTo(w * 0.15, h * 0.18);
  698. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.18, h * 0.15);
  699. c.lineTo(w * 0.82, h * 0.15);
  700. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.85, h * 0.18);
  701. c.lineTo(w * 0.85, h * 0.82);
  702. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.82, h * 0.85);
  703. c.lineTo(w * 0.18, h * 0.85);
  704. c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.15, h * 0.82);
  705. c.close();
  706. c.fill();
  707. var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  708. c.setFillColor(fillColor);
  709. c.begin();
  710. c.moveTo(w * 0.563, h * 0.34);
  711. c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.603, h * 0.42);
  712. c.lineTo(w * 0.44, h * 0.5);
  713. c.lineTo(w * 0.602, h * 0.582);
  714. c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.563, h * 0.653);
  715. c.lineTo(w * 0.403, h * 0.575);
  716. c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.4, h * 0.42);
  717. c.close();
  718. c.fill();
  719. };
  720. mxCellRenderer.registerShape(mxShapeMockupShare.prototype.cst.SHAPE_SHARE, mxShapeMockupShare);
  721. //**********************************************************************************************************************************************************
  722. //Trashcan Icon
  723. //**********************************************************************************************************************************************************
  724. /**
  725. * Extends mxShape.
  726. */
  727. function mxShapeMockupTrashcan(bounds, fill, stroke, strokewidth)
  728. {
  729. mxShape.call(this);
  730. this.bounds = bounds;
  731. this.fill = fill;
  732. this.stroke = stroke;
  733. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  734. };
  735. /**
  736. * Extends mxShape.
  737. */
  738. mxUtils.extend(mxShapeMockupTrashcan, mxShape);
  739. mxShapeMockupTrashcan.prototype.cst = {
  740. SHAPE_TRASHCAN : 'mxgraph.mockup.misc.trashcanIcon'
  741. };
  742. /**
  743. * Function: paintVertexShape
  744. *
  745. * Paints the vertex shape.
  746. */
  747. mxShapeMockupTrashcan.prototype.paintVertexShape = function(c, x, y, w, h)
  748. {
  749. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  750. c.translate(x, y);
  751. c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
  752. c.fillAndStroke();
  753. c.setShadow(false);
  754. c.setFillColor(strokeColor);
  755. c.begin();
  756. c.moveTo(w * 0.24, h * 0.24);
  757. c.arcTo(w * 0.04, h * 0.04, 0, 0, 1, w * 0.24, h * 0.16);
  758. c.lineTo(w * 0.4, h * 0.16);
  759. c.lineTo(w * 0.4, h * 0.12);
  760. c.lineTo(w * 0.6, h * 0.12);
  761. c.lineTo(w * 0.6, h * 0.16);
  762. c.lineTo(w * 0.76, h * 0.16);
  763. c.arcTo(w * 0.04, h * 0.04, 0, 0, 1, w * 0.76, h * 0.24);
  764. c.close();
  765. c.fill();
  766. c.roundrect(w * 0.26, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
  767. c.fill();
  768. c.roundrect(w * 0.44, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
  769. c.fill();
  770. c.roundrect(w * 0.62, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
  771. c.fill();
  772. };
  773. mxCellRenderer.registerShape(mxShapeMockupTrashcan.prototype.cst.SHAPE_TRASHCAN, mxShapeMockupTrashcan);
  774. //**********************************************************************************************************************************************************
  775. //Copyright Icon
  776. //**********************************************************************************************************************************************************
  777. /**
  778. * Extends mxShape.
  779. */
  780. function mxShapeMockupCopyright(bounds, fill, stroke, strokewidth)
  781. {
  782. mxShape.call(this);
  783. this.bounds = bounds;
  784. this.fill = fill;
  785. this.stroke = stroke;
  786. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  787. };
  788. /**
  789. * Extends mxShape.
  790. */
  791. mxUtils.extend(mxShapeMockupCopyright, mxShape);
  792. mxShapeMockupCopyright.prototype.cst = {
  793. SHAPE_COPYRIGHT : 'mxgraph.mockup.misc.copyrightIcon'
  794. };
  795. /**
  796. * Function: paintVertexShape
  797. *
  798. * Paints the vertex shape.
  799. */
  800. mxShapeMockupCopyright.prototype.paintVertexShape = function(c, x, y, w, h)
  801. {
  802. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  803. c.translate(x, y);
  804. c.ellipse(0, 0, w, h);
  805. c.fillAndStroke();
  806. c.setShadow(false);
  807. c.setFillColor(strokeColor);
  808. c.begin();
  809. c.moveTo(w * 0.713, h * 0.288);
  810. c.arcTo(w * 0.3, h * 0.3, 0, 1, 0, w * 0.713, h * 0.712);
  811. c.lineTo(w * 0.784, h * 0.783);
  812. c.arcTo(w * 0.4, h * 0.4, 0, 1, 1, w * 0.784, h * 0.217);
  813. c.close();
  814. c.fill();
  815. };
  816. mxCellRenderer.registerShape(mxShapeMockupCopyright.prototype.cst.SHAPE_COPYRIGHT, mxShapeMockupCopyright);
  817. //**********************************************************************************************************************************************************
  818. //Registered Icon
  819. //**********************************************************************************************************************************************************
  820. /**
  821. * Extends mxShape.
  822. */
  823. function mxShapeMockupRegistered(bounds, fill, stroke, strokewidth)
  824. {
  825. mxShape.call(this);
  826. this.bounds = bounds;
  827. this.fill = fill;
  828. this.stroke = stroke;
  829. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  830. };
  831. /**
  832. * Extends mxShape.
  833. */
  834. mxUtils.extend(mxShapeMockupRegistered, mxShape);
  835. mxShapeMockupRegistered.prototype.cst = {
  836. SHAPE_REGISTERED : 'mxgraph.mockup.misc.registeredIcon'
  837. };
  838. /**
  839. * Function: paintVertexShape
  840. *
  841. * Paints the vertex shape.
  842. */
  843. mxShapeMockupRegistered.prototype.paintVertexShape = function(c, x, y, w, h)
  844. {
  845. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  846. c.translate(x, y);
  847. c.ellipse(0, 0, w, h);
  848. c.fillAndStroke();
  849. c.setShadow(false);
  850. c.setFillColor(strokeColor);
  851. c.begin();
  852. c.moveTo(w * 0.29, h * 0.9);
  853. c.lineTo(w * 0.29, h * 0.09);
  854. c.lineTo(w * 0.5, h * 0.09);
  855. c.arcTo(w * 0.2195, h * 0.2195, 0, 0, 1, w * 0.545, h * 0.525);
  856. c.lineTo(w * 0.738, h * 0.91);
  857. c.lineTo(w * 0.674, h * 0.91);
  858. c.lineTo(w * 0.4825, h * 0.53);
  859. c.lineTo(w * 0.35, h * 0.53);
  860. c.lineTo(w * 0.35, h * 0.9);
  861. c.close();
  862. c.moveTo(w * 0.35, h * 0.47);
  863. c.lineTo(w * 0.5, h * 0.47);
  864. c.arcTo(w * 0.15, h * 0.15, 0, 0, 0, w * 0.5, h * 0.15);
  865. c.lineTo(w * 0.35, h * 0.15);
  866. c.close();
  867. c.fill();
  868. };
  869. mxCellRenderer.registerShape(mxShapeMockupRegistered.prototype.cst.SHAPE_REGISTERED, mxShapeMockupRegistered);
  870. //**********************************************************************************************************************************************************
  871. //Volume Icon
  872. //**********************************************************************************************************************************************************
  873. /**
  874. * Extends mxShape.
  875. */
  876. function mxShapeMockupVolume(bounds, fill, stroke, strokewidth)
  877. {
  878. mxShape.call(this);
  879. this.bounds = bounds;
  880. this.fill = fill;
  881. this.stroke = stroke;
  882. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  883. };
  884. /**
  885. * Extends mxShape.
  886. */
  887. mxUtils.extend(mxShapeMockupVolume, mxShape);
  888. mxShapeMockupVolume.prototype.cst = {
  889. SHAPE_VOLUME : 'mxgraph.mockup.misc.volumeIcon'
  890. };
  891. /**
  892. * Function: paintVertexShape
  893. *
  894. * Paints the vertex shape.
  895. */
  896. mxShapeMockupVolume.prototype.paintVertexShape = function(c, x, y, w, h)
  897. {
  898. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
  899. c.translate(x, y);
  900. c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
  901. c.fillAndStroke();
  902. c.setShadow(false);
  903. c.setFillColor(strokeColor);
  904. c.begin();
  905. c.moveTo(w * 0.1, h * 0.3);
  906. c.lineTo(w * 0.3, h * 0.3);
  907. c.lineTo(w * 0.5, h * 0.15);
  908. c.lineTo(w * 0.5, h * 0.85);
  909. c.lineTo(w * 0.3, h * 0.7);
  910. c.lineTo(w * 0.1, h * 0.7);
  911. c.close();
  912. c.fill();
  913. c.begin();
  914. c.moveTo(w * 0.6, h * 0.4);
  915. c.arcTo(w * 0.2, h * 0.2, 0, 0, 1, w * 0.6, h * 0.6);
  916. c.moveTo(w * 0.7, h * 0.3);
  917. c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, w * 0.7, h * 0.7);
  918. c.moveTo(w * 0.8, h * 0.2);
  919. c.arcTo(w * 0.4, h * 0.4, 0, 0, 1, w * 0.8, h * 0.8);
  920. c.stroke();
  921. };
  922. mxCellRenderer.registerShape(mxShapeMockupVolume.prototype.cst.SHAPE_VOLUME, mxShapeMockupVolume);
  923. //**********************************************************************************************************************************************************
  924. //Ruler
  925. //**********************************************************************************************************************************************************
  926. /**
  927. * Extends mxShape.
  928. */
  929. function mxShapeMockupRuler(bounds, fill, stroke, strokewidth)
  930. {
  931. mxShape.call(this);
  932. this.bounds = bounds;
  933. this.fill = fill;
  934. this.stroke = stroke;
  935. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  936. };
  937. /**
  938. * Extends mxShape.
  939. */
  940. mxUtils.extend(mxShapeMockupRuler, mxShape);
  941. mxShapeMockupRuler.prototype.cst = {
  942. SHAPE_RULER : 'mxgraph.mockup.misc.ruler',
  943. ORIENTATION : 'rulerOrient',
  944. UNIT_SIZE : 'unitSize',
  945. FACE_UP : 'up',
  946. FACE_DOWN : 'down'
  947. };
  948. /**
  949. * Function: paintVertexShape
  950. *
  951. * Paints the vertex shape.
  952. */
  953. mxShapeMockupRuler.prototype.paintVertexShape = function(c, x, y, w, h)
  954. {
  955. c.translate(x, y);
  956. this.background(c, w, h);
  957. c.setShadow(false);
  958. this.foreground(c, w, h);
  959. };
  960. mxShapeMockupRuler.prototype.background = function(c, w, h)
  961. {
  962. c.rect(0, 0, w, h);
  963. c.fillAndStroke();
  964. };
  965. mxShapeMockupRuler.prototype.foreground = function(c, w, h)
  966. {
  967. var facing = mxUtils.getValue(this.style, mxShapeMockupRuler.prototype.cst.ORIENTATION, mxShapeMockupRuler.prototype.cst.FACE_DOWN);
  968. var unitSize = mxUtils.getValue(this.style, mxShapeMockupRuler.prototype.cst.UNIT_SIZE, '10');
  969. unitSize = Math.max(unitSize, 1);
  970. var currX = unitSize;
  971. var i = 1;
  972. if (facing === mxShapeMockupRuler.prototype.cst.FACE_DOWN)
  973. {
  974. c.begin();
  975. while (currX < w)
  976. {
  977. var remainder = i % 10;
  978. if (remainder === 0)
  979. {
  980. c.moveTo(currX, h * 0.5);
  981. c.lineTo(currX, h);
  982. }
  983. else if ( remainder === 5)
  984. {
  985. c.moveTo(currX, h * 0.7);
  986. c.lineTo(currX, h);
  987. }
  988. else
  989. {
  990. c.moveTo(currX, h * 0.8);
  991. c.lineTo(currX, h);
  992. }
  993. currX = currX + unitSize;
  994. i = i + 1;
  995. }
  996. c.stroke();
  997. }
  998. else if (facing === mxShapeMockupRuler.prototype.cst.FACE_UP)
  999. {
  1000. c.begin();
  1001. while (currX < w)
  1002. {
  1003. var remainder = i % 10;
  1004. if (remainder === 0)
  1005. {
  1006. c.moveTo(currX, h * 0.5);
  1007. c.lineTo(currX, 0);
  1008. }
  1009. else if ( remainder === 5)
  1010. {
  1011. c.moveTo(currX, h * 0.3);
  1012. c.lineTo(currX, 0);
  1013. }
  1014. else
  1015. {
  1016. c.moveTo(currX, h * 0.2);
  1017. c.lineTo(currX, 0);
  1018. }
  1019. currX = currX + unitSize;
  1020. i = i + 1;
  1021. }
  1022. c.stroke();
  1023. }
  1024. };
  1025. mxCellRenderer.registerShape(mxShapeMockupRuler.prototype.cst.SHAPE_RULER, mxShapeMockupRuler);
  1026. //**********************************************************************************************************************************************************
  1027. //Advanced Ruler
  1028. //**********************************************************************************************************************************************************
  1029. /**
  1030. * Extends mxShape.
  1031. */
  1032. function mxShapeMockupRuler2(bounds, fill, stroke, strokewidth)
  1033. {
  1034. mxShape.call(this);
  1035. this.bounds = bounds;
  1036. this.fill = fill;
  1037. this.stroke = stroke;
  1038. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1039. };
  1040. /**
  1041. * Extends mxShape.
  1042. */
  1043. mxUtils.extend(mxShapeMockupRuler2, mxShape);
  1044. mxShapeMockupRuler2.prototype.cst = {
  1045. SHAPE_RULER : 'mxgraph.mockup.misc.ruler2',
  1046. ORIENTATION : 'rulerOrient',
  1047. UNIT_SIZE : 'dx',
  1048. FACE_UP : 'up',
  1049. FACE_DOWN : 'down'
  1050. };
  1051. mxShapeMockupRuler2.prototype.customProperties = [
  1052. {name: 'rulerOrient', dispName: 'Orientation', defVal:'up', type: 'enum',
  1053. enumList: [{val: 'up', dispName: 'Up'}, {val: 'down', dispName: 'Down'}]
  1054. },
  1055. {name: 'dx', dispName: 'Unit Size', type: 'float', min:0, defVal:100}
  1056. ];
  1057. /**
  1058. * Function: paintVertexShape
  1059. *
  1060. * Paints the vertex shape.
  1061. */
  1062. mxShapeMockupRuler2.prototype.paintVertexShape = function(c, x, y, w, h)
  1063. {
  1064. c.translate(x, y);
  1065. this.background(c, w, h);
  1066. c.setShadow(false);
  1067. this.foreground(c, x, y, w, h);
  1068. };
  1069. mxShapeMockupRuler2.prototype.background = function(c, w, h)
  1070. {
  1071. c.rect(0, 0, w, h);
  1072. c.fillAndStroke();
  1073. };
  1074. mxShapeMockupRuler2.prototype.foreground = function(c, x, y, w, h)
  1075. {
  1076. var facing = mxUtils.getValue(this.style, mxShapeMockupRuler2.prototype.cst.ORIENTATION, mxShapeMockupRuler2.prototype.cst.FACE_DOWN);
  1077. var fontColor = mxUtils.getValue(this.style, mxConstants.STYLE_FONTCOLOR, '#000000');
  1078. var dx = mxUtils.getValue(this.style, 'dx', '100');
  1079. var unitSize = dx / 10;
  1080. this.state.style['spacingLeft'] = Math.round(1000 * Math.max(0, Math.min(w, dx))) / 1000 - 4;
  1081. unitSize = Math.max(unitSize, 1);
  1082. c.setFontColor(fontColor);
  1083. var currX = unitSize;
  1084. var i = 1;
  1085. if (facing === mxShapeMockupRuler2.prototype.cst.FACE_DOWN)
  1086. {
  1087. c.begin();
  1088. while (currX < w)
  1089. {
  1090. var remainder = i % 10;
  1091. if (remainder === 0)
  1092. {
  1093. c.moveTo(currX, h - 10);
  1094. c.lineTo(currX, h);
  1095. var unit = this.state.view.graph.getLabel(this.state.cell);
  1096. if (!isNaN(unit))
  1097. {
  1098. c.stroke();
  1099. var num = i * Math.round(100 * unit) / 1000;
  1100. if (i != 10 && num != 0)
  1101. {
  1102. c.text(currX, (h - 10) * 0.5, 0, 0, num.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1103. }
  1104. c.begin();
  1105. }
  1106. }
  1107. else if ( remainder === 5)
  1108. {
  1109. c.moveTo(currX, h - 6);
  1110. c.lineTo(currX, h);
  1111. }
  1112. else
  1113. {
  1114. c.moveTo(currX, h - 4);
  1115. c.lineTo(currX, h);
  1116. }
  1117. currX = currX + unitSize;
  1118. i = i + 1;
  1119. }
  1120. c.stroke();
  1121. }
  1122. else if (facing === mxShapeMockupRuler2.prototype.cst.FACE_UP)
  1123. {
  1124. c.begin();
  1125. while (currX < w)
  1126. {
  1127. var remainder = i % 10;
  1128. if (remainder === 0)
  1129. {
  1130. c.moveTo(currX, 10);
  1131. c.lineTo(currX, 0);
  1132. var unit = this.state.view.graph.getLabel(this.state.cell);
  1133. if (!isNaN(unit))
  1134. {
  1135. c.stroke();
  1136. var num = i * Math.round(100 * unit) / 1000;
  1137. if (i != 10 && num != 0)
  1138. {
  1139. c.text(currX, (h + 10) * 0.5, 0, 0, num.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1140. }
  1141. c.begin();
  1142. }
  1143. }
  1144. else if ( remainder === 5)
  1145. {
  1146. c.moveTo(currX, 6);
  1147. c.lineTo(currX, 0);
  1148. }
  1149. else
  1150. {
  1151. c.moveTo(currX, 4);
  1152. c.lineTo(currX, 0);
  1153. }
  1154. currX = currX + unitSize;
  1155. i = i + 1;
  1156. }
  1157. c.stroke();
  1158. }
  1159. };
  1160. mxCellRenderer.registerShape(mxShapeMockupRuler2.prototype.cst.SHAPE_RULER, mxShapeMockupRuler2);
  1161. Graph.handleFactory[mxShapeMockupRuler2.prototype.cst.SHAPE_RULER] = function(state)
  1162. {
  1163. var handles = [Graph.createHandle(state, ['dx', 'spacingLeft', 'align', 'varticalAlign', 'spacingBottom', 'spacingTop', 'spacingRight', 'spacing'], function(bounds)
  1164. {
  1165. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1166. return new mxPoint(bounds.x + dx, bounds.y + bounds.height - 10);
  1167. }, function(bounds, pt)
  1168. {
  1169. this.state.style['dx'] = Math.round(1000 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 1000;
  1170. this.state.style['spacingLeft'] = Math.round(1000 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 1000 - 4;
  1171. this.state.style['align'] = 'left';
  1172. this.state.style['verticalAlign'] = 'middle';
  1173. var facing = mxUtils.getValue(this.state.style, 'rulerOrient', '1');
  1174. if (facing == 'down')
  1175. {
  1176. this.state.style['spacingBottom'] = 10;
  1177. this.state.style['spacingTop'] = 0;
  1178. }
  1179. else
  1180. {
  1181. this.state.style['spacingBottom'] = 0;
  1182. this.state.style['spacingTop'] = 10;
  1183. }
  1184. this.state.style['spacingRight'] = 0;
  1185. this.state.style['spacing'] = 0;
  1186. })];
  1187. return handles;
  1188. }
  1189. //**********************************************************************************************************************************************************
  1190. //Revision Table
  1191. //**********************************************************************************************************************************************************
  1192. /**
  1193. * Extends mxShape.
  1194. */
  1195. function mxShapeMockupRevisionTable(bounds, fill, stroke, strokewidth)
  1196. {
  1197. mxShape.call(this);
  1198. this.bounds = bounds;
  1199. this.fill = fill;
  1200. this.stroke = stroke;
  1201. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1202. };
  1203. /**
  1204. * Extends mxShape.
  1205. */
  1206. mxUtils.extend(mxShapeMockupRevisionTable, mxShape);
  1207. mxShapeMockupRevisionTable.prototype.cst = {
  1208. SHAPE_REVISION_TABLE : 'mxgraph.mockup.misc.revisionTable',
  1209. MAIN_TEXT : 'mainText',
  1210. TEXT_COLOR : 'textColor',
  1211. TEXT_SIZE : 'textSize'
  1212. };
  1213. /**
  1214. * Function: paintVertexShape
  1215. *
  1216. * Paints the vertex shape.
  1217. */
  1218. mxShapeMockupRevisionTable.prototype.paintVertexShape = function(c, x, y, w, h)
  1219. {
  1220. c.translate(x, y);
  1221. this.background(c, w, h);
  1222. c.setShadow(false);
  1223. this.foreground(c, w, h);
  1224. };
  1225. mxShapeMockupRevisionTable.prototype.background = function(c, w, h)
  1226. {
  1227. c.rect(0, 0, w, h);
  1228. c.fillAndStroke();
  1229. };
  1230. mxShapeMockupRevisionTable.prototype.foreground = function(c, w, h)
  1231. {
  1232. var mainText = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.MAIN_TEXT, '').toString().split(',');
  1233. var textColor = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.TEXT_COLOR, '#999999');
  1234. var textSize = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.TEXT_SIZE, '17');
  1235. c.begin();
  1236. c.moveTo(0, h * 0.33);
  1237. c.lineTo(w, h * 0.33);
  1238. c.moveTo(0, h * 0.67);
  1239. c.lineTo(w, h * 0.67);
  1240. c.moveTo(w * 0.125, h * 0.33);
  1241. c.lineTo(w * 0.125, h);
  1242. c.moveTo(w * 0.5, h * 0.33);
  1243. c.lineTo(w * 0.5, h);
  1244. c.stroke();
  1245. c.setFontSize(textSize);
  1246. c.setFontColor(textColor);
  1247. c.text(w * 0.5, h * 0.165, 0, 0, mainText[0], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1248. c.text(w * 0.0625, h * 0.5, 0, 0, mainText[1], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1249. c.text(w * 0.3125, h * 0.5, 0, 0, mainText[2], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1250. c.text(w * 0.75, h * 0.5, 0, 0, mainText[3], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1251. c.text(w * 0.0625, h * 0.835, 0, 0, mainText[4], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1252. c.text(w * 0.3125, h * 0.835, 0, 0, mainText[5], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1253. c.text(w * 0.75, h * 0.835, 0, 0, mainText[6], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1254. };
  1255. mxCellRenderer.registerShape(mxShapeMockupRevisionTable.prototype.cst.SHAPE_REVISION_TABLE, mxShapeMockupRevisionTable);
  1256. //**********************************************************************************************************************************************************
  1257. //Status Bar
  1258. //**********************************************************************************************************************************************************
  1259. /**
  1260. * Extends mxShape.
  1261. */
  1262. function mxShapeMockupStatusBar(bounds, fill, stroke, strokewidth)
  1263. {
  1264. mxShape.call(this);
  1265. this.bounds = bounds;
  1266. this.fill = fill;
  1267. this.stroke = stroke;
  1268. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1269. };
  1270. /**
  1271. * Extends mxShape.
  1272. */
  1273. mxUtils.extend(mxShapeMockupStatusBar, mxShape);
  1274. mxShapeMockupStatusBar.prototype.cst = {
  1275. SHAPE_STATUS_BAR : 'mxgraph.mockup.misc.statusBar',
  1276. MAIN_TEXT : 'mainText',
  1277. FILL_COLOR2 : 'fillColor2',
  1278. STROKE_COLOR2 : 'strokeColor2',
  1279. TEXT_COLOR : 'textColor',
  1280. TEXT_SIZE : 'textSize'
  1281. };
  1282. /**
  1283. * Function: paintVertexShape
  1284. *
  1285. * Paints the vertex shape.
  1286. */
  1287. mxShapeMockupStatusBar.prototype.paintVertexShape = function(c, x, y, w, h)
  1288. {
  1289. c.translate(x, y);
  1290. w = Math.max(w, 105);
  1291. this.background(c, w, h);
  1292. c.setShadow(false);
  1293. this.foreground(c, w, h);
  1294. };
  1295. mxShapeMockupStatusBar.prototype.background = function(c, w, h)
  1296. {
  1297. c.rect(0, h * 0.5 - 15, w, 30);
  1298. c.fillAndStroke();
  1299. };
  1300. mxShapeMockupStatusBar.prototype.foreground = function(c, w, h)
  1301. {
  1302. var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.FILL_COLOR2, '#ddeeff');
  1303. var strokeColor2 = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.STROKE_COLOR2, '#008cff');
  1304. var mainText = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.MAIN_TEXT, '').toString().split(',');
  1305. var textColor = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.TEXT_COLOR, '#999999');
  1306. var textSize = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.TEXT_SIZE, '17');
  1307. c.setFillColor(fillColor2);
  1308. c.roundrect(5, h * 0.5 - 10, (w - 75) * 0.46, 20, 5, 5);
  1309. c.fill();
  1310. c.roundrect(10 + (w - 75) * 0.46, h * 0.5 - 10, (w - 75) * 0.23, 20, 5, 5);
  1311. c.fill();
  1312. c.roundrect(15 + (w - 75) * 0.69, h * 0.5 - 10, (w - 75) * 0.276, 20, 5, 5);
  1313. c.fill();
  1314. c.setFontSize(textSize);
  1315. c.setFontColor(textColor);
  1316. c.text(10, h * 0.5, 0, 0, mainText[0], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1317. c.text(10 + (w - 75) * 0.575, h * 0.5, 0, 0, mainText[1], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1318. c.text(15 + (w - 75) * 0.828, h * 0.5, 0, 0, mainText[2], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1319. c.setStrokeColor(strokeColor2);
  1320. c.ellipse(w - 25, h * 0.5 - 10, 20, 20);
  1321. c.stroke();
  1322. c.begin();
  1323. c.moveTo(w - 55, h * 0.5 + 10);
  1324. c.lineTo(w - 35, h * 0.5 + 10);
  1325. c.stroke();
  1326. };
  1327. mxCellRenderer.registerShape(mxShapeMockupStatusBar.prototype.cst.SHAPE_STATUS_BAR, mxShapeMockupStatusBar);
  1328. //**********************************************************************************************************************************************************
  1329. //Pin
  1330. //**********************************************************************************************************************************************************
  1331. /**
  1332. * Extends mxShape.
  1333. */
  1334. function mxShapeMockupPin(bounds, fill, stroke, strokewidth)
  1335. {
  1336. mxShape.call(this);
  1337. this.bounds = bounds;
  1338. this.fill = fill;
  1339. this.stroke = stroke;
  1340. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1341. };
  1342. /**
  1343. * Extends mxShape.
  1344. */
  1345. mxUtils.extend(mxShapeMockupPin, mxShape);
  1346. mxShapeMockupPin.prototype.cst = {
  1347. SHAPE_PIN : 'mxgraph.mockup.misc.pin',
  1348. FILL_COLOR2 : 'fillColor2',
  1349. FILL_COLOR3 : 'fillColor3'
  1350. };
  1351. mxShapeMockupPin.prototype.customProperties = [
  1352. {name: 'fillColor2', dispName: 'Fill2 Color', type: 'color'},
  1353. {name: 'fillColor3', dispName: 'Fill3 Color', type: 'color'}
  1354. ];
  1355. /**
  1356. * Function: paintVertexShape
  1357. *
  1358. * Paints the vertex shape.
  1359. */
  1360. mxShapeMockupPin.prototype.paintVertexShape = function(c, x, y, w, h)
  1361. {
  1362. var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupPin.prototype.cst.FILL_COLOR2, '#000000');
  1363. var fillColor3 = mxUtils.getValue(this.style, mxShapeMockupPin.prototype.cst.FILL_COLOR3, '#000000');
  1364. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1365. c.setShadow(false);
  1366. c.translate(x, y);
  1367. c.setStrokeWidth(3);
  1368. c.setStrokeColor('#666666');
  1369. c.begin();
  1370. c.moveTo(w * 0.5, h * 0.4);
  1371. c.lineTo(w * 0.5, h);
  1372. c.stroke();
  1373. c.setStrokeWidth(2);
  1374. c.setStrokeColor(strokeColor);
  1375. c.setGradient(fillColor2, fillColor3, 0, 0, w, h * 0.4, mxConstants.DIRECTION_SOUTH, 1, 1);
  1376. c.setAlpha(0.9);
  1377. c.ellipse(0, 0, w, h * 0.4);
  1378. c.fillAndStroke();
  1379. c.setFillColor('#ffffff');
  1380. c.setAlpha(0.5);
  1381. c.ellipse(w * 0.2, h * 0.08, w * 0.3, h * 0.12);
  1382. c.fill();
  1383. };
  1384. mxCellRenderer.registerShape(mxShapeMockupPin.prototype.cst.SHAPE_PIN, mxShapeMockupPin);
  1385. //**********************************************************************************************************************************************************
  1386. //Rounded rectangle (adjustable rounding)
  1387. //**********************************************************************************************************************************************************
  1388. /**
  1389. * Extends mxShape.
  1390. */
  1391. function mxShapeMockupMiscRRect(bounds, fill, stroke, strokewidth)
  1392. {
  1393. mxShape.call(this);
  1394. this.bounds = bounds;
  1395. this.fill = fill;
  1396. this.stroke = stroke;
  1397. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1398. };
  1399. /**
  1400. * Extends mxShape.
  1401. */
  1402. mxUtils.extend(mxShapeMockupMiscRRect, mxShape);
  1403. mxShapeMockupMiscRRect.prototype.cst = {
  1404. RRECT : 'mxgraph.mockup.misc.rrect',
  1405. R_SIZE : 'rSize'
  1406. };
  1407. mxShapeMockupMiscRRect.prototype.customProperties = [
  1408. {name: 'rSize', dispName: 'Arc Size', type: 'float', min:0, defVal:10}
  1409. ];
  1410. /**
  1411. * Function: paintVertexShape
  1412. *
  1413. * Paints the vertex shape.
  1414. */
  1415. mxShapeMockupMiscRRect.prototype.paintVertexShape = function(c, x, y, w, h)
  1416. {
  1417. c.translate(x, y);
  1418. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupMiscRRect.prototype.cst.R_SIZE, '10'));
  1419. c.roundrect(0, 0, w, h, rSize);
  1420. c.fillAndStroke();
  1421. };
  1422. mxCellRenderer.registerShape(mxShapeMockupMiscRRect.prototype.cst.RRECT, mxShapeMockupMiscRRect);
  1423. //**********************************************************************************************************************************************************
  1424. //Anchor (a dummy shape without visuals used for anchoring)
  1425. //**********************************************************************************************************************************************************
  1426. /**
  1427. * Extends mxShape.
  1428. */
  1429. function mxShapeMockupMiscAnchor(bounds, fill, stroke, strokewidth)
  1430. {
  1431. mxShape.call(this);
  1432. this.bounds = bounds;
  1433. };
  1434. /**
  1435. * Extends mxShape.
  1436. */
  1437. mxUtils.extend(mxShapeMockupMiscAnchor, mxShape);
  1438. mxShapeMockupMiscAnchor.prototype.cst = {
  1439. ANCHOR : 'mxgraph.mockup.misc.anchor'
  1440. };
  1441. /**
  1442. * Function: paintVertexShape
  1443. *
  1444. * Paints the vertex shape.
  1445. */
  1446. mxShapeMockupMiscAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
  1447. {
  1448. };
  1449. mxCellRenderer.registerShape(mxShapeMockupMiscAnchor.prototype.cst.ANCHOR, mxShapeMockupMiscAnchor);