mxArrows.js 82 KB

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