mxArrows.js 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985
  1. /**
  2. * $Id: mxArrows.js,v 1.5 2016/03/23 12:32:06 mate Exp $
  3. * Copyright (c) 2006-2016, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Arrow
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeArrows2Arrow(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. this.dy = 0.5;
  19. this.dx = 0.5;
  20. this.notch = 0;
  21. };
  22. /**
  23. * Extends mxShape.
  24. */
  25. mxUtils.extend(mxShapeArrows2Arrow, mxActor);
  26. mxShapeArrows2Arrow.prototype.cst = {
  27. ARROW : 'mxgraph.arrows2.arrow'
  28. };
  29. /**
  30. * Function: paintVertexShape
  31. *
  32. * Paints the vertex shape.
  33. */
  34. mxShapeArrows2Arrow.prototype.paintVertexShape = function(c, x, y, w, h)
  35. {
  36. c.translate(x, y);
  37. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  38. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  39. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  40. c.begin();
  41. c.moveTo(0, dy);
  42. c.lineTo(w - dx, dy);
  43. c.lineTo(w - dx, 0);
  44. c.lineTo(w, h * 0.5);
  45. c.lineTo(w - dx, h);
  46. c.lineTo(w - dx, h - dy);
  47. c.lineTo(0, h - dy);
  48. c.lineTo(notch, h * 0.5);
  49. c.close();
  50. c.fillAndStroke();
  51. };
  52. mxCellRenderer.registerShape(mxShapeArrows2Arrow.prototype.cst.ARROW, mxShapeArrows2Arrow);
  53. mxShapeArrows2Arrow.prototype.constraints = null;
  54. Graph.handleFactory[mxShapeArrows2Arrow.prototype.cst.ARROW] = function(state)
  55. {
  56. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  57. {
  58. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  59. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  60. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  61. }, function(bounds, pt)
  62. {
  63. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  64. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  65. })];
  66. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  67. {
  68. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  69. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  70. }, function(bounds, pt)
  71. {
  72. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x))) / 100;
  73. });
  74. handles.push(handle2);
  75. return handles;
  76. }
  77. //**********************************************************************************************************************************************************
  78. //Two Way Arrow
  79. //**********************************************************************************************************************************************************
  80. /**
  81. * Extends mxShape.
  82. */
  83. function mxShapeArrows2TwoWayArrow(bounds, fill, stroke, strokewidth)
  84. {
  85. mxShape.call(this);
  86. this.bounds = bounds;
  87. this.fill = fill;
  88. this.stroke = stroke;
  89. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  90. this.dy = 0.5;
  91. this.dx = 0.5;
  92. };
  93. /**
  94. * Extends mxShape.
  95. */
  96. mxUtils.extend(mxShapeArrows2TwoWayArrow, mxActor);
  97. mxShapeArrows2TwoWayArrow.prototype.cst = {
  98. TWO_WAY_ARROW : 'mxgraph.arrows2.twoWayArrow'
  99. };
  100. /**
  101. * Function: paintVertexShape
  102. *
  103. * Paints the vertex shape.
  104. */
  105. mxShapeArrows2TwoWayArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  106. {
  107. c.translate(x, y);
  108. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  109. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  110. c.begin();
  111. c.moveTo(dx, dy);
  112. c.lineTo(w - dx, dy);
  113. c.lineTo(w - dx, 0);
  114. c.lineTo(w, h * 0.5);
  115. c.lineTo(w - dx, h);
  116. c.lineTo(w - dx, h - dy);
  117. c.lineTo(dx, h - dy);
  118. c.lineTo(dx, h);
  119. c.lineTo(0, h * 0.5);
  120. c.lineTo(dx, 0);
  121. c.close();
  122. c.fillAndStroke();
  123. };
  124. mxCellRenderer.registerShape(mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW, mxShapeArrows2TwoWayArrow);
  125. mxShapeArrows2TwoWayArrow.prototype.constraints = null;
  126. Graph.handleFactory[mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW] = function(state)
  127. {
  128. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  129. {
  130. var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  131. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  132. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  133. }, function(bounds, pt)
  134. {
  135. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, bounds.x + bounds.width - pt.x))) / 100;
  136. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  137. })];
  138. return handles;
  139. }
  140. //**********************************************************************************************************************************************************
  141. //Stylised Arrow
  142. //**********************************************************************************************************************************************************
  143. /**
  144. * Extends mxShape.
  145. */
  146. function mxShapeArrows2StylisedArrow(bounds, fill, stroke, strokewidth)
  147. {
  148. mxShape.call(this);
  149. this.bounds = bounds;
  150. this.fill = fill;
  151. this.stroke = stroke;
  152. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  153. this.dy = 0.5;
  154. this.dx = 0.5;
  155. this.notch = 0;
  156. this.feather = 0.5;
  157. };
  158. /**
  159. * Extends mxShape.
  160. */
  161. mxUtils.extend(mxShapeArrows2StylisedArrow, mxActor);
  162. mxShapeArrows2StylisedArrow.prototype.cst = {
  163. STYLISED_ARROW : 'mxgraph.arrows2.stylisedArrow'
  164. };
  165. /**
  166. * Function: paintVertexShape
  167. *
  168. * Paints the vertex shape.
  169. */
  170. mxShapeArrows2StylisedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  171. {
  172. c.translate(x, y);
  173. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  174. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  175. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  176. var feather = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'feather', this.feather))));
  177. c.begin();
  178. c.moveTo(0, feather);
  179. c.lineTo(w - dx, dy);
  180. c.lineTo(w - dx - 10, 0);
  181. c.lineTo(w, h * 0.5);
  182. c.lineTo(w - dx - 10, h);
  183. c.lineTo(w - dx, h - dy);
  184. c.lineTo(0, h - feather);
  185. c.lineTo(notch, h * 0.5);
  186. c.close();
  187. c.fillAndStroke();
  188. };
  189. mxCellRenderer.registerShape(mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW, mxShapeArrows2StylisedArrow);
  190. mxShapeArrows2StylisedArrow.prototype.constraints = null;
  191. Graph.handleFactory[mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW] = function(state)
  192. {
  193. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  194. {
  195. var dx = Math.max(0, Math.min(bounds.width - 10, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  196. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  197. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  198. }, function(bounds, pt)
  199. {
  200. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - 10, bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  201. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  202. })];
  203. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  204. {
  205. var notch = Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  206. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  207. }, function(bounds, pt)
  208. {
  209. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x))) / 100;
  210. });
  211. handles.push(handle2);
  212. var handle3 = Graph.createHandle(state, ['feather'], function(bounds)
  213. {
  214. var feather = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'feather', this.dy))));
  215. return new mxPoint(bounds.x, bounds.y + feather * bounds.height / 2);
  216. }, function(bounds, pt)
  217. {
  218. this.state.style['feather'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  219. });
  220. handles.push(handle3);
  221. return handles;
  222. }
  223. //**********************************************************************************************************************************************************
  224. //Sharp Arrow
  225. //**********************************************************************************************************************************************************
  226. /**
  227. * Extends mxShape.
  228. */
  229. function mxShapeArrows2SharpArrow(bounds, fill, stroke, strokewidth)
  230. {
  231. mxShape.call(this);
  232. this.bounds = bounds;
  233. this.fill = fill;
  234. this.stroke = stroke;
  235. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  236. this.dy1 = 0.5;
  237. this.dx1 = 0.5;
  238. this.dx2 = 0.5;
  239. this.notch = 0;
  240. };
  241. /**
  242. * Extends mxShape.
  243. */
  244. mxUtils.extend(mxShapeArrows2SharpArrow, mxActor);
  245. mxShapeArrows2SharpArrow.prototype.cst = {
  246. SHARP_ARROW : 'mxgraph.arrows2.sharpArrow'
  247. };
  248. /**
  249. * Function: paintVertexShape
  250. *
  251. * Paints the vertex shape.
  252. */
  253. mxShapeArrows2SharpArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  254. {
  255. c.translate(x, y);
  256. var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  257. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  258. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  259. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  260. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  261. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  262. var x2 = 0;
  263. if (h != 0)
  264. {
  265. x2 = dx1a + dx2 * dy1a * 2 / h;
  266. }
  267. c.begin();
  268. c.moveTo(0, dy1);
  269. c.lineTo(w - dx1, dy1);
  270. c.lineTo(w - x2, 0);
  271. c.lineTo(w - dx2, 0);
  272. c.lineTo(w, h * 0.5);
  273. c.lineTo(w - dx2, h);
  274. c.lineTo(w - x2, h);
  275. c.lineTo(w - dx1, h - dy1);
  276. c.lineTo(0, h - dy1);
  277. c.lineTo(notch, h * 0.5);
  278. c.close();
  279. c.fillAndStroke();
  280. };
  281. mxCellRenderer.registerShape(mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW, mxShapeArrows2SharpArrow);
  282. mxShapeArrows2SharpArrow.prototype.constraints = null;
  283. Graph.handleFactory[mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW] = function(state)
  284. {
  285. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  286. {
  287. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  288. var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  289. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);
  290. }, function(bounds, pt)
  291. {
  292. this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  293. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  294. })];
  295. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  296. {
  297. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  298. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  299. }, function(bounds, pt)
  300. {
  301. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.x - bounds.x))) / 100;
  302. });
  303. handles.push(handle2);
  304. var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
  305. {
  306. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  307. return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);
  308. }, function(bounds, pt)
  309. {
  310. this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  311. });
  312. handles.push(handle3);
  313. return handles;
  314. }
  315. //**********************************************************************************************************************************************************
  316. //Sharp Arrow2
  317. //**********************************************************************************************************************************************************
  318. /**
  319. * Extends mxShape.
  320. */
  321. function mxShapeArrows2SharpArrow2(bounds, fill, stroke, strokewidth)
  322. {
  323. mxShape.call(this);
  324. this.bounds = bounds;
  325. this.fill = fill;
  326. this.stroke = stroke;
  327. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  328. this.dy1 = 0.5;
  329. this.dx1 = 0.5;
  330. this.dx2 = 0.5;
  331. this.dy3 = 0.5;
  332. this.dx3 = 0.5;
  333. this.notch = 0;
  334. };
  335. /**
  336. * Extends mxShape.
  337. */
  338. mxUtils.extend(mxShapeArrows2SharpArrow2, mxActor);
  339. mxShapeArrows2SharpArrow2.prototype.cst = {
  340. SHARP_ARROW2 : 'mxgraph.arrows2.sharpArrow2'
  341. };
  342. /**
  343. * Function: paintVertexShape
  344. *
  345. * Paints the vertex shape.
  346. */
  347. mxShapeArrows2SharpArrow2.prototype.paintVertexShape = function(c, x, y, w, h)
  348. {
  349. c.translate(x, y);
  350. var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  351. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  352. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  353. var dy3 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy3', this.dy3))));
  354. var dx3 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx3', this.dx3))));
  355. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  356. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  357. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  358. c.begin();
  359. c.moveTo(0, dy1);
  360. c.lineTo(w - dx1, dy1);
  361. c.lineTo(w - dx3, dy3);
  362. c.lineTo(w - dx2, 0);
  363. c.lineTo(w, h * 0.5);
  364. c.lineTo(w - dx2, h);
  365. c.lineTo(w - dx3, h - dy3);
  366. c.lineTo(w - dx1, h - dy1);
  367. c.lineTo(0, h - dy1);
  368. c.lineTo(notch, h * 0.5);
  369. c.close();
  370. c.fillAndStroke();
  371. };
  372. mxCellRenderer.registerShape(mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2, mxShapeArrows2SharpArrow2);
  373. mxShapeArrows2SharpArrow2.prototype.constraints = null;
  374. Graph.handleFactory[mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2] = function(state)
  375. {
  376. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  377. {
  378. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  379. var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  380. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);
  381. }, function(bounds, pt)
  382. {
  383. this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  384. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  385. })];
  386. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  387. {
  388. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  389. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  390. }, function(bounds, pt)
  391. {
  392. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.x - bounds.x))) / 100;
  393. });
  394. handles.push(handle2);
  395. var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
  396. {
  397. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  398. return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);
  399. }, function(bounds, pt)
  400. {
  401. this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  402. });
  403. handles.push(handle3);
  404. var handle4 = Graph.createHandle(state, ['dx3', 'dy3'], function(bounds)
  405. {
  406. var dx3 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx3', this.dx3))));
  407. var dy3 = Math.max(0, Math.min(1 - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy3', this.dy3))));
  408. return new mxPoint(bounds.x + bounds.width - dx3, bounds.y + dy3 * bounds.height / 2);
  409. }, function(bounds, pt)
  410. {
  411. this.state.style['dx3'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;
  412. this.state.style['dy3'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  413. });
  414. handles.push(handle4);
  415. return handles;
  416. }
  417. //**********************************************************************************************************************************************************
  418. //Callout Arrow
  419. //**********************************************************************************************************************************************************
  420. /**
  421. * Extends mxShape.
  422. */
  423. function mxShapeArrows2CalloutArrow(bounds, fill, stroke, strokewidth)
  424. {
  425. mxShape.call(this);
  426. this.bounds = bounds;
  427. this.fill = fill;
  428. this.stroke = stroke;
  429. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  430. this.dy = 0.5;
  431. this.dx = 0.5;
  432. this.notch = 0;
  433. this.arrowHead = 0;
  434. };
  435. /**
  436. * Extends mxShape.
  437. */
  438. mxUtils.extend(mxShapeArrows2CalloutArrow, mxActor);
  439. mxShapeArrows2CalloutArrow.prototype.cst = {
  440. CALLOUT_ARROW : 'mxgraph.arrows2.calloutArrow'
  441. };
  442. /**
  443. * Function: paintVertexShape
  444. *
  445. * Paints the vertex shape.
  446. */
  447. mxShapeArrows2CalloutArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  448. {
  449. c.translate(x, y);
  450. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  451. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  452. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  453. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  454. c.begin();
  455. c.moveTo(0, 0);
  456. c.lineTo(notch, 0);
  457. c.lineTo(notch, h * 0.5 - dy);
  458. c.lineTo(w - dx, h * 0.5 - dy);
  459. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  460. c.lineTo(w, h * 0.5);
  461. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  462. c.lineTo(w - dx, h * 0.5 + dy);
  463. c.lineTo(notch, h * 0.5 + dy);
  464. c.lineTo(notch, h);
  465. c.lineTo(0, h);
  466. c.close();
  467. c.fillAndStroke();
  468. };
  469. mxCellRenderer.registerShape(mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW, mxShapeArrows2CalloutArrow);
  470. mxShapeArrows2CalloutArrow.prototype.constraints = null;
  471. Graph.handleFactory[mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW] = function(state)
  472. {
  473. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  474. {
  475. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  476. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  477. var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  478. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  479. }, function(bounds, pt)
  480. {
  481. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  482. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  483. })];
  484. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  485. {
  486. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  487. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  488. }, function(bounds, pt)
  489. {
  490. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x))) / 100;
  491. });
  492. handles.push(handle2);
  493. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  494. {
  495. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  496. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  497. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  498. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  499. }, function(bounds, pt)
  500. {
  501. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), bounds.y + bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) - pt.y))) / 100;
  502. });
  503. handles.push(handle3);
  504. return handles;
  505. }
  506. //**********************************************************************************************************************************************************
  507. //Bend Arrow
  508. //**********************************************************************************************************************************************************
  509. /**
  510. * Extends mxShape.
  511. */
  512. function mxShapeArrows2BendArrow(bounds, fill, stroke, strokewidth)
  513. {
  514. mxShape.call(this);
  515. this.bounds = bounds;
  516. this.fill = fill;
  517. this.stroke = stroke;
  518. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  519. this.dy = 0.5;
  520. this.dx = 0.5;
  521. this.notch = 0;
  522. this.arrowHead = 40;
  523. };
  524. /**
  525. * Extends mxShape.
  526. */
  527. mxUtils.extend(mxShapeArrows2BendArrow, mxActor);
  528. mxShapeArrows2BendArrow.prototype.cst = {
  529. BEND_ARROW : 'mxgraph.arrows2.bendArrow'
  530. };
  531. /**
  532. * Function: paintVertexShape
  533. *
  534. * Paints the vertex shape.
  535. */
  536. mxShapeArrows2BendArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  537. {
  538. c.translate(x, y);
  539. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  540. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  541. var notch = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  542. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  543. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  544. c.begin();
  545. c.moveTo(w - dx, 0);
  546. c.lineTo(w, arrowHead * 0.5);
  547. c.lineTo(w - dx, arrowHead);
  548. c.lineTo(w - dx, arrowHead / 2 + dy);
  549. if (rounded == '1')
  550. {
  551. c.lineTo(dy * 2.2, arrowHead / 2 + dy);
  552. c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, dy * 2, arrowHead / 2 + dy * 1.2);
  553. }
  554. else
  555. {
  556. c.lineTo(dy * 2, arrowHead / 2 + dy);
  557. }
  558. c.lineTo(dy * 2, h);
  559. c.lineTo(dy, h - notch);
  560. c.lineTo(0, h);
  561. if (rounded == '1')
  562. {
  563. c.lineTo(0, arrowHead / 2 + dy);
  564. c.arcTo(dy * 2, dy * 2, 0, 0, 1, dy * 2, arrowHead / 2 - dy);
  565. }
  566. else
  567. {
  568. c.lineTo(0, arrowHead / 2 - dy);
  569. }
  570. c.lineTo(w - dx, arrowHead / 2 - dy);
  571. c.close();
  572. c.fillAndStroke();
  573. };
  574. mxCellRenderer.registerShape(mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW, mxShapeArrows2BendArrow);
  575. mxShapeArrows2BendArrow.prototype.constraints = null;
  576. Graph.handleFactory[mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW] = function(state)
  577. {
  578. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  579. {
  580. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  581. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  582. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  583. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  584. }, function(bounds, pt)
  585. {
  586. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) * 2.2, bounds.x + bounds.width - pt.x))) / 100;
  587. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - pt.y))) / 100;
  588. })];
  589. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  590. {
  591. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  592. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  593. var notch = Math.max(0, Math.min(bounds.height - arrowHead / 2 - dy, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  594. return new mxPoint(bounds.x + dy, bounds.y + bounds.height - notch);
  595. }, function(bounds, pt)
  596. {
  597. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), bounds.y + bounds.height - pt.y))) / 100;
  598. });
  599. handles.push(handle2);
  600. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  601. {
  602. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  603. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  604. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  605. }, function(bounds, pt)
  606. {
  607. this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(bounds.height, pt.y - bounds.y))) / 100;
  608. });
  609. handles.push(handle3);
  610. return handles;
  611. }
  612. //**********************************************************************************************************************************************************
  613. //Bend Double Arrow
  614. //**********************************************************************************************************************************************************
  615. /**
  616. * Extends mxShape.
  617. */
  618. function mxShapeArrows2BendDoubleArrow(bounds, fill, stroke, strokewidth)
  619. {
  620. mxShape.call(this);
  621. this.bounds = bounds;
  622. this.fill = fill;
  623. this.stroke = stroke;
  624. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  625. this.dy = 0.5;
  626. this.dx = 0.5;
  627. this.notch = 0;
  628. this.arrowHead = 40;
  629. };
  630. /**
  631. * Extends mxShape.
  632. */
  633. mxUtils.extend(mxShapeArrows2BendDoubleArrow, mxActor);
  634. mxShapeArrows2BendDoubleArrow.prototype.cst = {
  635. BEND_DOUBLE_ARROW : 'mxgraph.arrows2.bendDoubleArrow'
  636. };
  637. /**
  638. * Function: paintVertexShape
  639. *
  640. * Paints the vertex shape.
  641. */
  642. mxShapeArrows2BendDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  643. {
  644. c.translate(x, y);
  645. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  646. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  647. var arrowHead = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  648. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  649. c.begin();
  650. c.moveTo(w - dx, 0);
  651. c.lineTo(w, arrowHead * 0.5);
  652. c.lineTo(w - dx, arrowHead);
  653. c.lineTo(w - dx, arrowHead / 2 + dy);
  654. if (rounded == '1')
  655. {
  656. c.lineTo(arrowHead / 2 + dy * 1.2, arrowHead / 2 + dy);
  657. c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, arrowHead /2 + dy, arrowHead / 2 + dy * 1.2);
  658. }
  659. else
  660. {
  661. c.lineTo(arrowHead / 2 + dy, arrowHead / 2 + dy);
  662. }
  663. c.lineTo(arrowHead / 2 + dy, h - dx);
  664. c.lineTo(arrowHead, h - dx);
  665. c.lineTo(arrowHead / 2, h);
  666. c.lineTo(0, h - dx);
  667. c.lineTo(arrowHead / 2 - dy, h - dx);
  668. if (rounded == '1')
  669. {
  670. c.lineTo(arrowHead / 2 - dy, arrowHead / 2 + dy);
  671. c.arcTo(dy * 2, dy * 2, 0, 0, 1, arrowHead / 2 + dy, arrowHead / 2 - dy);
  672. }
  673. else
  674. {
  675. c.lineTo(arrowHead / 2 - dy, arrowHead / 2 - dy);
  676. }
  677. c.lineTo(w - dx, arrowHead / 2 - dy);
  678. c.close();
  679. c.fillAndStroke();
  680. };
  681. mxCellRenderer.registerShape(mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW, mxShapeArrows2BendDoubleArrow);
  682. mxShapeArrows2BendDoubleArrow.prototype.constraints = null;
  683. Graph.handleFactory[mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW] = function(state)
  684. {
  685. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  686. {
  687. var arrowHead = Math.max(0, Math.min(Math.min(bounds.height, bounds.width) - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  688. var dx = Math.max(0, Math.min(Math.min(bounds.width, bounds.height) - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  689. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  690. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  691. }, function(bounds, pt)
  692. {
  693. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(Math.min(bounds.width, bounds.height) - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.x + bounds.width - pt.x))) / 100;
  694. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - pt.y))) / 100;
  695. })];
  696. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  697. {
  698. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  699. var arrowHead = Math.max(0, Math.min(Math.min(bounds.height, bounds.width) - dx, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  700. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  701. }, function(bounds, pt)
  702. {
  703. this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(Math.min(bounds.height, bounds.width) - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.y - bounds.y))) / 100;
  704. });
  705. handles.push(handle2);
  706. return handles;
  707. }
  708. //**********************************************************************************************************************************************************
  709. //Callout Double Arrow
  710. //**********************************************************************************************************************************************************
  711. /**
  712. * Extends mxShape.
  713. */
  714. function mxShapeArrows2CalloutDoubleArrow(bounds, fill, stroke, strokewidth)
  715. {
  716. mxShape.call(this);
  717. this.bounds = bounds;
  718. this.fill = fill;
  719. this.stroke = stroke;
  720. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  721. this.dy = 0.5;
  722. this.dx = 0.5;
  723. this.notch = 0;
  724. this.arrowHead = 0;
  725. };
  726. /**
  727. * Extends mxShape.
  728. */
  729. mxUtils.extend(mxShapeArrows2CalloutDoubleArrow, mxActor);
  730. mxShapeArrows2CalloutDoubleArrow.prototype.cst = {
  731. CALLOUT_DOUBLE_ARROW : 'mxgraph.arrows2.calloutDoubleArrow'
  732. };
  733. /**
  734. * Function: paintVertexShape
  735. *
  736. * Paints the vertex shape.
  737. */
  738. mxShapeArrows2CalloutDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  739. {
  740. c.translate(x, y);
  741. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  742. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  743. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  744. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  745. c.begin();
  746. c.moveTo(w / 2 - notch, 0);
  747. c.lineTo(w / 2 + notch, 0);
  748. c.lineTo(w / 2 + notch, h * 0.5 - dy);
  749. c.lineTo(w - dx, h * 0.5 - dy);
  750. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  751. c.lineTo(w, h * 0.5);
  752. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  753. c.lineTo(w - dx, h * 0.5 + dy);
  754. c.lineTo(w / 2 + notch, h * 0.5 + dy);
  755. c.lineTo(w / 2 + notch, h);
  756. c.lineTo(w / 2 - notch, h);
  757. c.lineTo(w / 2 - notch, h * 0.5 + dy);
  758. c.lineTo(dx, h * 0.5 + dy);
  759. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  760. c.lineTo(0, h * 0.5);
  761. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  762. c.lineTo(dx, h * 0.5 - dy);
  763. c.lineTo(w / 2 - notch, h * 0.5 - dy);
  764. c.close();
  765. c.fillAndStroke();
  766. };
  767. mxCellRenderer.registerShape(mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW, mxShapeArrows2CalloutDoubleArrow);
  768. mxShapeArrows2CalloutDoubleArrow.prototype.constraints = null;
  769. Graph.handleFactory[mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW] = function(state)
  770. {
  771. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  772. {
  773. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  774. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  775. var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  776. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  777. }, function(bounds, pt)
  778. {
  779. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2 - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  780. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  781. })];
  782. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  783. {
  784. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  785. return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);
  786. }, function(bounds, pt)
  787. {
  788. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x - bounds.width / 2))) / 100;
  789. });
  790. handles.push(handle2);
  791. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  792. {
  793. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  794. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  795. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  796. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  797. }, function(bounds, pt)
  798. {
  799. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), bounds.y + bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) - pt.y))) / 100;
  800. });
  801. handles.push(handle3);
  802. return handles;
  803. }
  804. //**********************************************************************************************************************************************************
  805. //Callout Quad Arrow
  806. //**********************************************************************************************************************************************************
  807. /**
  808. * Extends mxShape.
  809. */
  810. function mxShapeArrows2CalloutQuadArrow(bounds, fill, stroke, strokewidth)
  811. {
  812. mxShape.call(this);
  813. this.bounds = bounds;
  814. this.fill = fill;
  815. this.stroke = stroke;
  816. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  817. this.dy = 0.5;
  818. this.dx = 0.5;
  819. this.notch = 0;
  820. this.arrowHead = 0;
  821. };
  822. /**
  823. * Extends mxShape.
  824. */
  825. mxUtils.extend(mxShapeArrows2CalloutQuadArrow, mxActor);
  826. mxShapeArrows2CalloutQuadArrow.prototype.cst = {
  827. CALLOUT_QUAD_ARROW : 'mxgraph.arrows2.calloutQuadArrow'
  828. };
  829. /**
  830. * Function: paintVertexShape
  831. *
  832. * Paints the vertex shape.
  833. */
  834. mxShapeArrows2CalloutQuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  835. {
  836. c.translate(x, y);
  837. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  838. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  839. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  840. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  841. c.begin();
  842. c.moveTo(w * 0.5 + dy, h * 0.5 - notch);
  843. c.lineTo(w * 0.5 + notch, h * 0.5 - notch);
  844. c.lineTo(w * 0.5 + notch, h * 0.5 - dy);
  845. c.lineTo(w - dx, h * 0.5 - dy);
  846. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  847. c.lineTo(w, h * 0.5);
  848. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  849. c.lineTo(w - dx, h * 0.5 + dy);
  850. c.lineTo(w * 0.5 + notch, h * 0.5 + dy);
  851. c.lineTo(w * 0.5 + notch, h * 0.5 + notch);
  852. c.lineTo(w * 0.5 + dy, h * 0.5 + notch);
  853. c.lineTo(w * 0.5 + dy, h - dx);
  854. c.lineTo(w * 0.5 + dy + arrowHead, h - dx);
  855. c.lineTo(w * 0.5, h);
  856. c.lineTo(w * 0.5 - dy - arrowHead, h - dx);
  857. c.lineTo(w * 0.5 - dy, h - dx);
  858. c.lineTo(w * 0.5 - dy, h * 0.5 + notch);
  859. c.lineTo(w * 0.5 - notch, h * 0.5 + notch);
  860. c.lineTo(w * 0.5 - notch, h * 0.5 + dy);
  861. c.lineTo(dx, h * 0.5 + dy);
  862. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  863. c.lineTo(0, h * 0.5);
  864. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  865. c.lineTo(dx, h * 0.5 - dy);
  866. c.lineTo(w * 0.5 - notch, h * 0.5 - dy);
  867. c.lineTo(w * 0.5 - notch, h * 0.5 - notch);
  868. c.lineTo(w * 0.5 - dy, h * 0.5 - notch);
  869. c.lineTo(w * 0.5 - dy, dx);
  870. c.lineTo(w * 0.5 - dy - arrowHead, dx);
  871. c.lineTo(w * 0.5, 0);
  872. c.lineTo(w * 0.5 + dy + arrowHead, dx);
  873. c.lineTo(w * 0.5 + dy, dx);
  874. c.close();
  875. c.fillAndStroke();
  876. };
  877. mxCellRenderer.registerShape(mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW, mxShapeArrows2CalloutQuadArrow);
  878. mxShapeArrows2CalloutQuadArrow.prototype.constraints = null;
  879. Graph.handleFactory[mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW] = function(state)
  880. {
  881. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  882. {
  883. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  884. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  885. var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  886. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  887. }, function(bounds, pt)
  888. {
  889. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(Math.min(bounds.width, bounds.height) / 2 - Math.max(parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))), bounds.x + bounds.width - pt.x))) / 100;
  890. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  891. })];
  892. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  893. {
  894. var notch = Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(Math.min(bounds.width, bounds.height), parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  895. return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);
  896. }, function(bounds, pt)
  897. {
  898. this.state.style['notch'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(Math.min(bounds.width, bounds.height) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x - bounds.width / 2))) / 100;
  899. });
  900. handles.push(handle2);
  901. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  902. {
  903. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  904. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  905. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  906. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  907. }, function(bounds, pt)
  908. {
  909. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  910. });
  911. handles.push(handle3);
  912. return handles;
  913. }
  914. //**********************************************************************************************************************************************************
  915. //Callout Double 90 Arrow
  916. //**********************************************************************************************************************************************************
  917. /**
  918. * Extends mxShape.
  919. */
  920. function mxShapeArrows2CalloutDouble90Arrow(bounds, fill, stroke, strokewidth)
  921. {
  922. mxShape.call(this);
  923. this.bounds = bounds;
  924. this.fill = fill;
  925. this.stroke = stroke;
  926. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  927. this.dy1 = 0.5;
  928. this.dx1 = 0.5;
  929. this.dx2 = 0;
  930. this.dy2 = 0;
  931. this.arrowHead = 0;
  932. };
  933. /**
  934. * Extends mxShape.
  935. */
  936. mxUtils.extend(mxShapeArrows2CalloutDouble90Arrow, mxActor);
  937. mxShapeArrows2CalloutDouble90Arrow.prototype.cst = {
  938. CALLOUT_DOUBLE_90_ARROW : 'mxgraph.arrows2.calloutDouble90Arrow'
  939. };
  940. /**
  941. * Function: paintVertexShape
  942. *
  943. * Paints the vertex shape.
  944. */
  945. mxShapeArrows2CalloutDouble90Arrow.prototype.paintVertexShape = function(c, x, y, w, h)
  946. {
  947. c.translate(x, y);
  948. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  949. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  950. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  951. var dy2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  952. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  953. c.begin();
  954. c.moveTo(0, 0);
  955. c.lineTo(dx2, 0);
  956. c.lineTo(dx2, dy2 * 0.5 - dy1);
  957. c.lineTo(w - dx1, dy2 * 0.5 - dy1);
  958. c.lineTo(w - dx1, dy2 * 0.5 - dy1 - arrowHead);
  959. c.lineTo(w, dy2 * 0.5);
  960. c.lineTo(w - dx1, dy2 * 0.5 + dy1 + arrowHead);
  961. c.lineTo(w - dx1, dy2 * 0.5 + dy1);
  962. c.lineTo(dx2, dy2 * 0.5 + dy1);
  963. c.lineTo(dx2, dy2);
  964. c.lineTo(dx2 / 2 + dy1, dy2);
  965. c.lineTo(dx2 / 2 + dy1, h - dx1);
  966. c.lineTo(dx2 / 2 + dy1 + arrowHead, h - dx1);
  967. c.lineTo(dx2 / 2, h);
  968. c.lineTo(dx2 / 2 - dy1 - arrowHead, h - dx1);
  969. c.lineTo(dx2 / 2 - dy1, h - dx1);
  970. c.lineTo(dx2 / 2 - dy1, dy2);
  971. c.lineTo(0, dy2);
  972. c.close();
  973. c.fillAndStroke();
  974. };
  975. mxCellRenderer.registerShape(mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW, mxShapeArrows2CalloutDouble90Arrow);
  976. mxShapeArrows2CalloutDouble90Arrow.prototype.constraints = null;
  977. Graph.handleFactory[mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW] = function(state)
  978. {
  979. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  980. {
  981. var arrowHead = Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  982. var dx1 = Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  983. var dy1 = Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  984. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1);
  985. }, function(bounds, pt)
  986. {
  987. this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)), bounds.x + bounds.width - pt.x))) / 100;
  988. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - pt.y))) / 100;
  989. })];
  990. var handle2 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  991. {
  992. var dx2 = Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  993. var dy2 = Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), Math.min(bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
  994. return new mxPoint(bounds.x + dx2, bounds.y + dy2);
  995. }, function(bounds, pt)
  996. {
  997. this.state.style['dx2'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.x - bounds.x))) / 100;
  998. this.state.style['dy2'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), Math.min(bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.y - bounds.y))) / 100;
  999. });
  1000. handles.push(handle2);
  1001. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1002. {
  1003. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1004. var dy1 = Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1005. var arrowHead = Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1006. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1 - arrowHead);
  1007. }, function(bounds, pt)
  1008. {
  1009. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) - pt.y))) / 100;
  1010. });
  1011. handles.push(handle3);
  1012. return handles;
  1013. }
  1014. //**********************************************************************************************************************************************************
  1015. //Quad Arrow
  1016. //**********************************************************************************************************************************************************
  1017. /**
  1018. * Extends mxShape.
  1019. */
  1020. function mxShapeArrows2QuadArrow(bounds, fill, stroke, strokewidth)
  1021. {
  1022. mxShape.call(this);
  1023. this.bounds = bounds;
  1024. this.fill = fill;
  1025. this.stroke = stroke;
  1026. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1027. this.dy = 0.5;
  1028. this.dx = 0.5;
  1029. this.notch = 0;
  1030. this.arrowHead = 0;
  1031. };
  1032. /**
  1033. * Extends mxShape.
  1034. */
  1035. mxUtils.extend(mxShapeArrows2QuadArrow, mxActor);
  1036. mxShapeArrows2QuadArrow.prototype.cst = {
  1037. QUAD_ARROW : 'mxgraph.arrows2.quadArrow'
  1038. };
  1039. /**
  1040. * Function: paintVertexShape
  1041. *
  1042. * Paints the vertex shape.
  1043. */
  1044. mxShapeArrows2QuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1045. {
  1046. c.translate(x, y);
  1047. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1048. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1049. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1050. c.begin();
  1051. c.moveTo(w * 0.5 + dy, h * 0.5 - dy);
  1052. c.lineTo(w - dx, h * 0.5 - dy);
  1053. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  1054. c.lineTo(w, h * 0.5);
  1055. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  1056. c.lineTo(w - dx, h * 0.5 + dy);
  1057. c.lineTo(w * 0.5 + dy, h * 0.5 + dy);
  1058. c.lineTo(w * 0.5 + dy, h - dx);
  1059. c.lineTo(w * 0.5 + dy + arrowHead, h - dx);
  1060. c.lineTo(w * 0.5, h);
  1061. c.lineTo(w * 0.5 - dy - arrowHead, h - dx);
  1062. c.lineTo(w * 0.5 - dy, h - dx);
  1063. c.lineTo(w * 0.5 - dy, h * 0.5 + dy);
  1064. c.lineTo(dx, h * 0.5 + dy);
  1065. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  1066. c.lineTo(0, h * 0.5);
  1067. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  1068. c.lineTo(dx, h * 0.5 - dy);
  1069. c.lineTo(w * 0.5 - dy, h * 0.5 - dy);
  1070. c.lineTo(w * 0.5 - dy, dx);
  1071. c.lineTo(w * 0.5 - dy - arrowHead, dx);
  1072. c.lineTo(w * 0.5, 0);
  1073. c.lineTo(w * 0.5 + dy + arrowHead, dx);
  1074. c.lineTo(w * 0.5 + dy, dx);
  1075. c.close();
  1076. c.fillAndStroke();
  1077. };
  1078. mxCellRenderer.registerShape(mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW, mxShapeArrows2QuadArrow);
  1079. mxShapeArrows2QuadArrow.prototype.constraints = null;
  1080. Graph.handleFactory[mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW] = function(state)
  1081. {
  1082. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1083. {
  1084. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1085. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1086. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1087. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  1088. }, function(bounds, pt)
  1089. {
  1090. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(Math.min(bounds.width, bounds.height) / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.x + bounds.width - pt.x))) / 100;
  1091. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1092. })];
  1093. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1094. {
  1095. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1096. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1097. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1098. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  1099. }, function(bounds, pt)
  1100. {
  1101. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1102. });
  1103. handles.push(handle2);
  1104. return handles;
  1105. }
  1106. //**********************************************************************************************************************************************************
  1107. //Triad Arrow
  1108. //**********************************************************************************************************************************************************
  1109. /**
  1110. * Extends mxShape.
  1111. */
  1112. function mxShapeArrows2TriadArrow(bounds, fill, stroke, strokewidth)
  1113. {
  1114. mxShape.call(this);
  1115. this.bounds = bounds;
  1116. this.fill = fill;
  1117. this.stroke = stroke;
  1118. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1119. this.dy = 0.5;
  1120. this.dx = 0.5;
  1121. this.arrowHead = 0;
  1122. };
  1123. /**
  1124. * Extends mxShape.
  1125. */
  1126. mxUtils.extend(mxShapeArrows2TriadArrow, mxActor);
  1127. mxShapeArrows2TriadArrow.prototype.cst = {
  1128. TRIAD_ARROW : 'mxgraph.arrows2.triadArrow'
  1129. };
  1130. /**
  1131. * Function: paintVertexShape
  1132. *
  1133. * Paints the vertex shape.
  1134. */
  1135. mxShapeArrows2TriadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1136. {
  1137. c.translate(x, y);
  1138. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1139. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1140. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1141. c.begin();
  1142. c.moveTo(w * 0.5 + arrowHead * 0.5 - dy, h - arrowHead + dy);
  1143. c.lineTo(w - dx, h - arrowHead + dy);
  1144. c.lineTo(w - dx, h - arrowHead);
  1145. c.lineTo(w, h - arrowHead * 0.5);
  1146. c.lineTo(w - dx, h);
  1147. c.lineTo(w - dx, h - dy);
  1148. c.lineTo(dx, h - dy);
  1149. c.lineTo(dx, h);
  1150. c.lineTo(0, h - arrowHead * 0.5);
  1151. c.lineTo(dx, h - arrowHead);
  1152. c.lineTo(dx, h - arrowHead + dy);
  1153. c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, h - arrowHead + dy);
  1154. c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, dx);
  1155. c.lineTo(w * 0.5 - arrowHead * 0.5, dx);
  1156. c.lineTo(w * 0.5, 0);
  1157. c.lineTo(w * 0.5 + arrowHead * 0.5, dx);
  1158. c.lineTo(w * 0.5 + arrowHead * 0.5 - dy, dx);
  1159. c.close();
  1160. c.fillAndStroke();
  1161. };
  1162. mxCellRenderer.registerShape(mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW, mxShapeArrows2TriadArrow);
  1163. mxShapeArrows2TriadArrow.prototype.constraints = null;
  1164. Graph.handleFactory[mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW] = function(state)
  1165. {
  1166. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1167. {
  1168. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1169. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1170. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1171. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - dy);
  1172. }, function(bounds, pt)
  1173. {
  1174. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(Math.min(bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), bounds.width / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2), bounds.x + bounds.width - pt.x))) / 100;
  1175. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + bounds.height - pt.y))) / 100;
  1176. })];
  1177. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1178. {
  1179. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1180. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1181. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1182. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - arrowHead);
  1183. }, function(bounds, pt)
  1184. {
  1185. this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(bounds.height - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)) * 2, bounds.y + bounds.height - pt.y))) / 100;
  1186. });
  1187. handles.push(handle2);
  1188. return handles;
  1189. }
  1190. //**********************************************************************************************************************************************************
  1191. //Tailed Arrow
  1192. //**********************************************************************************************************************************************************
  1193. /**
  1194. * Extends mxShape.
  1195. */
  1196. function mxShapeArrows2TailedArrow(bounds, fill, stroke, strokewidth)
  1197. {
  1198. mxShape.call(this);
  1199. this.bounds = bounds;
  1200. this.fill = fill;
  1201. this.stroke = stroke;
  1202. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1203. this.dy = 0.5;
  1204. this.dx = 0.5;
  1205. this.notch = 0;
  1206. this.arrowHead = 0;
  1207. };
  1208. /**
  1209. * Extends mxShape.
  1210. */
  1211. mxUtils.extend(mxShapeArrows2TailedArrow, mxActor);
  1212. mxShapeArrows2TailedArrow.prototype.cst = {
  1213. TAILED_ARROW : 'mxgraph.arrows2.tailedArrow'
  1214. };
  1215. /**
  1216. * Function: paintVertexShape
  1217. *
  1218. * Paints the vertex shape.
  1219. */
  1220. mxShapeArrows2TailedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1221. {
  1222. c.translate(x, y);
  1223. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1224. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1225. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1226. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1227. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1228. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1229. var x2 = 0;
  1230. if (dy2 != 0)
  1231. {
  1232. x2 = dx2 + dy2 * (dy2 - dy1) / dy2;
  1233. }
  1234. c.begin();
  1235. c.moveTo(0, h * 0.5 - dy2);
  1236. c.lineTo(dx2, h * 0.5 - dy2);
  1237. c.lineTo(x2, h * 0.5 - dy1);
  1238. c.lineTo(w - dx1, h * 0.5 - dy1);
  1239. c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);
  1240. c.lineTo(w, h * 0.5);
  1241. c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);
  1242. c.lineTo(w - dx1, h * 0.5 + dy1);
  1243. c.lineTo(x2, h * 0.5 + dy1);
  1244. c.lineTo(dx2, h * 0.5 + dy2);
  1245. c.lineTo(0, h * 0.5 + dy2);
  1246. c.lineTo(notch, h * 0.5);
  1247. c.close();
  1248. c.fillAndStroke();
  1249. };
  1250. mxCellRenderer.registerShape(mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW, mxShapeArrows2TailedArrow);
  1251. mxShapeArrows2TailedArrow.prototype.constraints = null;
  1252. Graph.handleFactory[mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW] = function(state)
  1253. {
  1254. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  1255. {
  1256. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1257. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1258. var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1259. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);
  1260. }, function(bounds, pt)
  1261. {
  1262. this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), bounds.x + bounds.width - pt.x))) / 100;
  1263. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1264. })];
  1265. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1266. {
  1267. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1268. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  1269. }, function(bounds, pt)
  1270. {
  1271. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), pt.x - bounds.x))) / 100;
  1272. });
  1273. handles.push(handle2);
  1274. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1275. {
  1276. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1277. var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1278. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1279. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);
  1280. }, function(bounds, pt)
  1281. {
  1282. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1283. });
  1284. handles.push(handle3);
  1285. var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  1286. {
  1287. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  1288. var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
  1289. return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);
  1290. }, function(bounds, pt)
  1291. {
  1292. this.state.style['dx2'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)) - parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) + parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)) - 1, pt.x - bounds.x))) / 100;
  1293. this.state.style['dy2'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), Math.min(bounds.height / 2, bounds.y + bounds.height / 2 - pt.y))) / 100;
  1294. });
  1295. handles.push(handle4);
  1296. return handles;
  1297. }
  1298. //**********************************************************************************************************************************************************
  1299. //Tailed Arrow with Notch
  1300. //**********************************************************************************************************************************************************
  1301. /**
  1302. * Extends mxShape.
  1303. */
  1304. function mxShapeArrows2TailedNotchedArrow(bounds, fill, stroke, strokewidth)
  1305. {
  1306. mxShape.call(this);
  1307. this.bounds = bounds;
  1308. this.fill = fill;
  1309. this.stroke = stroke;
  1310. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1311. this.dy = 0.5;
  1312. this.dx = 0.5;
  1313. this.notch = 0;
  1314. this.arrowHead = 0;
  1315. };
  1316. /**
  1317. * Extends mxShape.
  1318. */
  1319. mxUtils.extend(mxShapeArrows2TailedNotchedArrow, mxActor);
  1320. mxShapeArrows2TailedNotchedArrow.prototype.cst = {
  1321. TAILED_NOTCHED_ARROW : 'mxgraph.arrows2.tailedNotchedArrow'
  1322. };
  1323. /**
  1324. * Function: paintVertexShape
  1325. *
  1326. * Paints the vertex shape.
  1327. */
  1328. mxShapeArrows2TailedNotchedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1329. {
  1330. c.translate(x, y);
  1331. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1332. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1333. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1334. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1335. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1336. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1337. var x2 = 0;
  1338. if (dy2 != 0)
  1339. {
  1340. x2 = dx2 + notch * (dy2 - dy1) / dy2;
  1341. }
  1342. c.begin();
  1343. c.moveTo(0, h * 0.5 - dy2);
  1344. c.lineTo(dx2, h * 0.5 - dy2);
  1345. c.lineTo(x2, h * 0.5 - dy1);
  1346. c.lineTo(w - dx1, h * 0.5 - dy1);
  1347. c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);
  1348. c.lineTo(w, h * 0.5);
  1349. c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);
  1350. c.lineTo(w - dx1, h * 0.5 + dy1);
  1351. c.lineTo(x2, h * 0.5 + dy1);
  1352. c.lineTo(dx2, h * 0.5 + dy2);
  1353. c.lineTo(0, h * 0.5 + dy2);
  1354. c.lineTo(notch, h * 0.5);
  1355. c.close();
  1356. c.fillAndStroke();
  1357. };
  1358. mxCellRenderer.registerShape(mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW, mxShapeArrows2TailedNotchedArrow);
  1359. mxShapeArrows2TailedNotchedArrow.prototype.constraints = null;
  1360. Graph.handleFactory[mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW] = function(state)
  1361. {
  1362. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  1363. {
  1364. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1365. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1366. var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1367. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);
  1368. }, function(bounds, pt)
  1369. {
  1370. this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))- parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2)), bounds.x + bounds.width - pt.x))) / 100;
  1371. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)), parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1372. })];
  1373. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1374. {
  1375. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1376. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  1377. }, function(bounds, pt)
  1378. {
  1379. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.x - bounds.x))) / 100;
  1380. });
  1381. handles.push(handle2);
  1382. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1383. {
  1384. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1385. var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1386. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1387. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);
  1388. }, function(bounds, pt)
  1389. {
  1390. this.state.style['arrowHead'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2 - parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), bounds.y + bounds.height / 2 - pt.y))) / 100;
  1391. });
  1392. handles.push(handle3);
  1393. var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  1394. {
  1395. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  1396. var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
  1397. return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);
  1398. }, function(bounds, pt)
  1399. {
  1400. this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)) - parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1)), pt.x - bounds.x))) / 100;
  1401. this.state.style['dy2'] = Math.round(100 * Math.max(parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1)), Math.min(bounds.height / 2, bounds.y + bounds.height / 2 - pt.y))) / 100;
  1402. });
  1403. handles.push(handle4);
  1404. return handles;
  1405. }
  1406. //**********************************************************************************************************************************************************
  1407. //Striped Arrow
  1408. //**********************************************************************************************************************************************************
  1409. /**
  1410. * Extends mxShape.
  1411. */
  1412. function mxShapeArrows2StripedArrow(bounds, fill, stroke, strokewidth)
  1413. {
  1414. mxShape.call(this);
  1415. this.bounds = bounds;
  1416. this.fill = fill;
  1417. this.stroke = stroke;
  1418. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1419. this.dy = 0.5;
  1420. this.dx = 0.5;
  1421. this.notch = 0;
  1422. };
  1423. /**
  1424. * Extends mxShape.
  1425. */
  1426. mxUtils.extend(mxShapeArrows2StripedArrow, mxActor);
  1427. mxShapeArrows2StripedArrow.prototype.cst = {
  1428. STRIPED_ARROW : 'mxgraph.arrows2.stripedArrow'
  1429. };
  1430. /**
  1431. * Function: paintVertexShape
  1432. *
  1433. * Paints the vertex shape.
  1434. */
  1435. mxShapeArrows2StripedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1436. {
  1437. c.translate(x, y);
  1438. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1439. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1440. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1441. c.begin();
  1442. c.moveTo(notch, dy);
  1443. c.lineTo(w - dx, dy);
  1444. c.lineTo(w - dx, 0);
  1445. c.lineTo(w, h * 0.5);
  1446. c.lineTo(w - dx, h);
  1447. c.lineTo(w - dx, h - dy);
  1448. c.lineTo(notch, h - dy);
  1449. c.close();
  1450. c.moveTo(0, h - dy);
  1451. c.lineTo(notch * 0.16, h - dy);
  1452. c.lineTo(notch * 0.16, dy);
  1453. c.lineTo(0, dy);
  1454. c.close();
  1455. c.moveTo(notch * 0.32, h - dy);
  1456. c.lineTo(notch * 0.8, h - dy);
  1457. c.lineTo(notch * 0.8, dy);
  1458. c.lineTo(notch * 0.32, dy);
  1459. c.close();
  1460. c.fillAndStroke();
  1461. };
  1462. mxCellRenderer.registerShape(mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW, mxShapeArrows2StripedArrow);
  1463. mxShapeArrows2StripedArrow.prototype.constraints = null;
  1464. Graph.handleFactory[mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW] = function(state)
  1465. {
  1466. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1467. {
  1468. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1469. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1470. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  1471. }, function(bounds, pt)
  1472. {
  1473. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;
  1474. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  1475. })];
  1476. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1477. {
  1478. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1479. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  1480. }, function(bounds, pt)
  1481. {
  1482. this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx)), pt.x - bounds.x))) / 100;
  1483. });
  1484. handles.push(handle2);
  1485. return handles;
  1486. }
  1487. //**********************************************************************************************************************************************************
  1488. //Jump-In Arrow
  1489. //**********************************************************************************************************************************************************
  1490. /**
  1491. * Extends mxShape.
  1492. */
  1493. function mxShapeArrows2JumpInArrow(bounds, fill, stroke, strokewidth)
  1494. {
  1495. mxShape.call(this);
  1496. this.bounds = bounds;
  1497. this.fill = fill;
  1498. this.stroke = stroke;
  1499. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1500. this.dy = 0.5;
  1501. this.dx = 0.5;
  1502. this.arrowHead = 40;
  1503. };
  1504. /**
  1505. * Extends mxShape.
  1506. */
  1507. mxUtils.extend(mxShapeArrows2JumpInArrow, mxActor);
  1508. mxShapeArrows2JumpInArrow.prototype.cst = {
  1509. JUMP_IN_ARROW : 'mxgraph.arrows2.jumpInArrow'
  1510. };
  1511. /**
  1512. * Function: paintVertexShape
  1513. *
  1514. * Paints the vertex shape.
  1515. */
  1516. mxShapeArrows2JumpInArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1517. {
  1518. c.translate(x, y);
  1519. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1520. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1521. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1522. c.begin();
  1523. c.moveTo(w - dx, 0);
  1524. c.lineTo(w, arrowHead * 0.5);
  1525. c.lineTo(w - dx, arrowHead);
  1526. c.lineTo(w - dx, arrowHead / 2 + dy);
  1527. c.arcTo(w - dx, h - arrowHead / 2 - dy, 0, 0, 0, 0, h);
  1528. c.arcTo(w - dx, h - arrowHead / 2 + dy, 0, 0, 1, w - dx, arrowHead / 2 - dy);
  1529. c.close();
  1530. c.fillAndStroke();
  1531. };
  1532. mxCellRenderer.registerShape(mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW, mxShapeArrows2JumpInArrow);
  1533. mxShapeArrows2JumpInArrow.prototype.constraints = null;
  1534. Graph.handleFactory[mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW] = function(state)
  1535. {
  1536. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1537. {
  1538. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1539. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1540. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1541. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  1542. }, function(bounds, pt)
  1543. {
  1544. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;
  1545. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - pt.y))) / 100;
  1546. })];
  1547. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1548. {
  1549. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1550. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1551. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  1552. }, function(bounds, pt)
  1553. {
  1554. this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(bounds.height, pt.y - bounds.y))) / 100;
  1555. });
  1556. handles.push(handle2);
  1557. return handles;
  1558. }
  1559. //**********************************************************************************************************************************************************
  1560. //U Turn Arrow
  1561. //**********************************************************************************************************************************************************
  1562. /**
  1563. * Extends mxShape.
  1564. */
  1565. function mxShapeArrows2UTurnArrow(bounds, fill, stroke, strokewidth)
  1566. {
  1567. mxShape.call(this);
  1568. this.bounds = bounds;
  1569. this.fill = fill;
  1570. this.stroke = stroke;
  1571. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1572. this.dy = 0.5;
  1573. this.dx = 0.5;
  1574. this.arrowHead = 40;
  1575. };
  1576. /**
  1577. * Extends mxShape.
  1578. */
  1579. mxUtils.extend(mxShapeArrows2UTurnArrow, mxActor);
  1580. mxShapeArrows2UTurnArrow.prototype.cst = {
  1581. U_TURN_ARROW : 'mxgraph.arrows2.uTurnArrow'
  1582. };
  1583. /**
  1584. * Function: paintVertexShape
  1585. *
  1586. * Paints the vertex shape.
  1587. */
  1588. mxShapeArrows2UTurnArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1589. {
  1590. c.translate(x, y);
  1591. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1592. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1593. var dx = (h - arrowHead / 2 + dy) / 2;
  1594. var dx2 = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2)));
  1595. c.begin();
  1596. c.moveTo(dx, 0);
  1597. c.lineTo(dx + dx2, arrowHead * 0.5);
  1598. c.lineTo(dx, arrowHead);
  1599. c.lineTo(dx, arrowHead / 2 + dy);
  1600. c.arcTo(dx - 2 * dy, dx - 2 * dy, 0, 0, 0, dx, h - 2 * dy);
  1601. c.lineTo(Math.max(w, dx), h - 2 * dy);
  1602. c.lineTo(Math.max(w, dx), h);
  1603. c.lineTo(dx, h);
  1604. c.arcTo(dx, dx, 0, 0, 1, dx, arrowHead / 2 - dy);
  1605. c.close();
  1606. c.fillAndStroke();
  1607. };
  1608. mxCellRenderer.registerShape(mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW, mxShapeArrows2UTurnArrow);
  1609. mxShapeArrows2UTurnArrow.prototype.constraints = null;
  1610. Graph.handleFactory[mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW] = function(state)
  1611. {
  1612. var handles = [Graph.createHandle(state, ['dy'], function(bounds)
  1613. {
  1614. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1615. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1616. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  1617. return new mxPoint(bounds.x + dx, bounds.y + arrowHead / 2 - dy);
  1618. }, function(bounds, pt)
  1619. {
  1620. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - pt.y))) / 100;
  1621. })];
  1622. var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)
  1623. {
  1624. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1625. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1626. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  1627. var dx2 = Math.max(0, Math.min(bounds.width - dx, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  1628. return new mxPoint(bounds.x + dx + dx2, bounds.y + arrowHead / 2);
  1629. }, function(bounds, pt)
  1630. {
  1631. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1632. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1633. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  1634. this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(Math.max(bounds.width, dx), pt.x - bounds.x - dx))) / 100;
  1635. });
  1636. handles.push(handle2);
  1637. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1638. {
  1639. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1640. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1641. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  1642. return new mxPoint(bounds.x + dx, bounds.y + arrowHead);
  1643. }, function(bounds, pt)
  1644. {
  1645. this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
  1646. });
  1647. handles.push(handle3);
  1648. return handles;
  1649. }