mxMockupMisc.js 50 KB

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