mxArrows.js 127 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882
  1. /**
  2. * Copyright (c) 2006-2016, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. //Arrow
  6. //**********************************************************************************************************************************************************
  7. /**
  8. * Extends mxShape.
  9. */
  10. function mxShapeArrows2Arrow(bounds, fill, stroke, strokewidth)
  11. {
  12. mxShape.call(this);
  13. this.bounds = bounds;
  14. this.fill = fill;
  15. this.stroke = stroke;
  16. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  17. this.dy = 0.5;
  18. this.dx = 0.5;
  19. this.notch = 0;
  20. };
  21. /**
  22. * Extends mxShape.
  23. */
  24. mxUtils.extend(mxShapeArrows2Arrow, mxActor);
  25. mxShapeArrows2Arrow.prototype.customProperties = [
  26. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min: 0, defVal: 40},
  27. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, max:1, defVal: 0.6},
  28. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal: 0},
  29. {name: 'headCrossline', dispName: 'Head Crossline', type: 'bool', defVal: false},
  30. {name: 'tailCrossline', dispName: 'Tail Crossline', type: 'bool', defVal: false}
  31. ];
  32. mxShapeArrows2Arrow.prototype.cst = {
  33. ARROW : 'mxgraph.arrows2.arrow'
  34. };
  35. /**
  36. * Function: paintVertexShape
  37. *
  38. * Paints the vertex shape.
  39. */
  40. mxShapeArrows2Arrow.prototype.paintVertexShape = function(c, x, y, w, h)
  41. {
  42. c.translate(x, y);
  43. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  44. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  45. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  46. var headCrossline = mxUtils.getValue(this.style, 'headCrossline', false);
  47. var tailCrossline = mxUtils.getValue(this.style, 'tailCrossline', false);
  48. c.begin();
  49. c.moveTo(0, dy);
  50. c.lineTo(w - dx, dy);
  51. c.lineTo(w - dx, 0);
  52. c.lineTo(w, h * 0.5);
  53. c.lineTo(w - dx, h);
  54. c.lineTo(w - dx, h - dy);
  55. c.lineTo(0, h - dy);
  56. c.lineTo(notch, h * 0.5);
  57. c.close();
  58. c.fillAndStroke();
  59. c.setShadow(false);
  60. if (headCrossline)
  61. {
  62. c.begin();
  63. c.moveTo(w - dx, dy);
  64. c.lineTo(w - dx, h - dy);
  65. c.stroke();
  66. }
  67. if (tailCrossline)
  68. {
  69. c.begin();
  70. c.moveTo(notch, dy);
  71. c.lineTo(notch, h - dy);
  72. c.stroke();
  73. }
  74. };
  75. mxShapeArrows2Arrow.prototype.getLabelBounds = function(rect)
  76. {
  77. if (mxUtils.getValue(this.style, 'boundedLbl', false))
  78. {
  79. var w = rect.width;
  80. var h = rect.height;
  81. var dy, dx;
  82. var direction = this.direction || mxConstants.DIRECTION_EAST;
  83. if (mxUtils.getValue(this.style, 'flipH', false))
  84. {
  85. if (direction == mxConstants.DIRECTION_WEST)
  86. direction = mxConstants.DIRECTION_EAST;
  87. else if (direction == mxConstants.DIRECTION_EAST)
  88. direction = mxConstants.DIRECTION_WEST;
  89. }
  90. if (mxUtils.getValue(this.style, 'flipV', false))
  91. {
  92. if (direction == mxConstants.DIRECTION_NORTH)
  93. direction = mxConstants.DIRECTION_SOUTH;
  94. else if (direction == mxConstants.DIRECTION_SOUTH)
  95. direction = mxConstants.DIRECTION_NORTH;
  96. }
  97. if (direction == mxConstants.DIRECTION_NORTH
  98. || direction == mxConstants.DIRECTION_SOUTH)
  99. {
  100. dy = w * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  101. dx = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  102. }
  103. else
  104. {
  105. dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  106. dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  107. }
  108. if (direction == mxConstants.DIRECTION_EAST)
  109. {
  110. return new mxRectangle(rect.x, rect.y + dy, w - dx, h - 2 * dy);
  111. }
  112. else if (direction == mxConstants.DIRECTION_WEST)
  113. {
  114. return new mxRectangle(rect.x + dx, rect.y + dy, w - dx, h - 2 * dy);
  115. }
  116. else if (direction == mxConstants.DIRECTION_NORTH)
  117. {
  118. return new mxRectangle(rect.x + dy, rect.y + dx, w - 2 * dy, h - dx);
  119. }
  120. else
  121. {
  122. return new mxRectangle(rect.x + dy, rect.y, w - 2 * dy, h - dx);
  123. }
  124. }
  125. return rect;
  126. };
  127. mxCellRenderer.registerShape(mxShapeArrows2Arrow.prototype.cst.ARROW, mxShapeArrows2Arrow);
  128. Graph.handleFactory[mxShapeArrows2Arrow.prototype.cst.ARROW] = function(state)
  129. {
  130. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  131. {
  132. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  133. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  134. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  135. }, function(bounds, pt)
  136. {
  137. 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;
  138. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  139. })];
  140. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  141. {
  142. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  143. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  144. }, function(bounds, pt)
  145. {
  146. 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;
  147. });
  148. handles.push(handle2);
  149. return handles;
  150. }
  151. mxShapeArrows2Arrow.prototype.getConstraints = function(style, w, h)
  152. {
  153. var constr = [];
  154. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  155. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  156. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  157. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  158. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  159. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
  160. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
  161. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dy));
  162. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
  163. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dy));
  164. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h));
  165. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, dy));
  166. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, h - dy));
  167. return (constr);
  168. };
  169. //**********************************************************************************************************************************************************
  170. //Two Way Arrow
  171. //**********************************************************************************************************************************************************
  172. /**
  173. * Extends mxShape.
  174. */
  175. function mxShapeArrows2TwoWayArrow(bounds, fill, stroke, strokewidth)
  176. {
  177. mxShape.call(this);
  178. this.bounds = bounds;
  179. this.fill = fill;
  180. this.stroke = stroke;
  181. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  182. this.dy = 0.5;
  183. this.dx = 0.5;
  184. };
  185. /**
  186. * Extends mxShape.
  187. */
  188. mxUtils.extend(mxShapeArrows2TwoWayArrow, mxActor);
  189. mxShapeArrows2TwoWayArrow.prototype.cst = {
  190. TWO_WAY_ARROW : 'mxgraph.arrows2.twoWayArrow'
  191. };
  192. mxShapeArrows2TwoWayArrow.prototype.customProperties = [
  193. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal: 35},
  194. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, max:1, defVal: 0.6}
  195. ];
  196. /**
  197. * Function: paintVertexShape
  198. *
  199. * Paints the vertex shape.
  200. */
  201. mxShapeArrows2TwoWayArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  202. {
  203. c.translate(x, y);
  204. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  205. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  206. c.begin();
  207. c.moveTo(dx, dy);
  208. c.lineTo(w - dx, dy);
  209. c.lineTo(w - dx, 0);
  210. c.lineTo(w, h * 0.5);
  211. c.lineTo(w - dx, h);
  212. c.lineTo(w - dx, h - dy);
  213. c.lineTo(dx, h - dy);
  214. c.lineTo(dx, h);
  215. c.lineTo(0, h * 0.5);
  216. c.lineTo(dx, 0);
  217. c.close();
  218. c.fillAndStroke();
  219. };
  220. mxShapeArrows2TwoWayArrow.prototype.getLabelBounds = function(rect)
  221. {
  222. if (mxUtils.getValue(this.style, 'boundedLbl', false))
  223. {
  224. var w = rect.width;
  225. var h = rect.height;
  226. var vertical = this.direction == mxConstants.DIRECTION_NORTH
  227. || this.direction == mxConstants.DIRECTION_SOUTH;
  228. var dy, dx;
  229. if (vertical)
  230. {
  231. dy = w * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  232. dx = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  233. }
  234. else
  235. {
  236. dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  237. dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  238. }
  239. if (vertical)
  240. {
  241. return new mxRectangle(rect.x + dy, rect.y + dx, w - 2 * dy, h - 2 * dx);
  242. }
  243. else
  244. {
  245. return new mxRectangle(rect.x + dx, rect.y + dy, w - 2 * dx, h - 2 * dy);
  246. }
  247. }
  248. return rect;
  249. };
  250. mxCellRenderer.registerShape(mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW, mxShapeArrows2TwoWayArrow);
  251. mxShapeArrows2TwoWayArrow.prototype.constraints = null;
  252. Graph.handleFactory[mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW] = function(state)
  253. {
  254. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  255. {
  256. var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  257. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  258. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  259. }, function(bounds, pt)
  260. {
  261. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, bounds.x + bounds.width - pt.x))) / 100;
  262. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  263. })];
  264. return handles;
  265. }
  266. mxShapeArrows2TwoWayArrow.prototype.getConstraints = function(style, w, h)
  267. {
  268. var constr = [];
  269. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  270. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  271. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  272. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));
  273. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dy));
  274. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
  275. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h - dy));
  276. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  277. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
  278. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dy));
  279. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h));
  280. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dy));
  281. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dy));
  282. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, h - dy));
  283. return (constr);
  284. };
  285. //**********************************************************************************************************************************************************
  286. //Stylised Arrow
  287. //**********************************************************************************************************************************************************
  288. /**
  289. * Extends mxShape.
  290. */
  291. function mxShapeArrows2StylisedArrow(bounds, fill, stroke, strokewidth)
  292. {
  293. mxShape.call(this);
  294. this.bounds = bounds;
  295. this.fill = fill;
  296. this.stroke = stroke;
  297. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  298. this.dy = 0.5;
  299. this.dx = 0.5;
  300. this.notch = 0;
  301. this.feather = 0.5;
  302. };
  303. /**
  304. * Extends mxShape.
  305. */
  306. mxUtils.extend(mxShapeArrows2StylisedArrow, mxActor);
  307. mxShapeArrows2StylisedArrow.prototype.customProperties = [
  308. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:40},
  309. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, max:1, defVal:0.6},
  310. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal:0},
  311. {name: 'feather', dispName: 'Feather', type: 'float', min:0, max:1, defVal:0.4},
  312. ];
  313. mxShapeArrows2StylisedArrow.prototype.cst = {
  314. STYLISED_ARROW : 'mxgraph.arrows2.stylisedArrow'
  315. };
  316. /**
  317. * Function: paintVertexShape
  318. *
  319. * Paints the vertex shape.
  320. */
  321. mxShapeArrows2StylisedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  322. {
  323. c.translate(x, y);
  324. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  325. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  326. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  327. var feather = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'feather', this.feather))));
  328. c.begin();
  329. c.moveTo(0, feather);
  330. c.lineTo(w - dx, dy);
  331. c.lineTo(w - dx - 10, 0);
  332. c.lineTo(w, h * 0.5);
  333. c.lineTo(w - dx - 10, h);
  334. c.lineTo(w - dx, h - dy);
  335. c.lineTo(0, h - feather);
  336. c.lineTo(notch, h * 0.5);
  337. c.close();
  338. c.fillAndStroke();
  339. };
  340. mxCellRenderer.registerShape(mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW, mxShapeArrows2StylisedArrow);
  341. mxShapeArrows2StylisedArrow.prototype.constraints = null;
  342. Graph.handleFactory[mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW] = function(state)
  343. {
  344. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  345. {
  346. var dx = Math.max(0, Math.min(bounds.width - 10, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  347. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  348. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  349. }, function(bounds, pt)
  350. {
  351. 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;
  352. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  353. })];
  354. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  355. {
  356. 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))));
  357. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  358. }, function(bounds, pt)
  359. {
  360. 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;
  361. });
  362. handles.push(handle2);
  363. var handle3 = Graph.createHandle(state, ['feather'], function(bounds)
  364. {
  365. var feather = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'feather', this.dy))));
  366. return new mxPoint(bounds.x, bounds.y + feather * bounds.height / 2);
  367. }, function(bounds, pt)
  368. {
  369. this.state.style['feather'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  370. });
  371. handles.push(handle3);
  372. return handles;
  373. }
  374. mxShapeArrows2StylisedArrow.prototype.getConstraints = function(style, w, h)
  375. {
  376. var constr = [];
  377. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  378. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  379. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  380. var feather = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'feather', this.feather))));
  381. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  382. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  383. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, feather));
  384. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - feather));
  385. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dy));
  386. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx - 10, 0));
  387. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dy));
  388. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx - 10, h));
  389. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, (dy + feather) * 0.5));
  390. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, h - (dy + feather) * 0.5));
  391. return (constr);
  392. };
  393. //**********************************************************************************************************************************************************
  394. //Sharp Arrow
  395. //**********************************************************************************************************************************************************
  396. /**
  397. * Extends mxShape.
  398. */
  399. function mxShapeArrows2SharpArrow(bounds, fill, stroke, strokewidth)
  400. {
  401. mxShape.call(this);
  402. this.bounds = bounds;
  403. this.fill = fill;
  404. this.stroke = stroke;
  405. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  406. this.dy1 = 0.5;
  407. this.dx1 = 0.5;
  408. this.dx2 = 0.5;
  409. this.notch = 0;
  410. };
  411. /**
  412. * Extends mxShape.
  413. */
  414. mxUtils.extend(mxShapeArrows2SharpArrow, mxActor);
  415. mxShapeArrows2SharpArrow.prototype.cst = {
  416. SHARP_ARROW : 'mxgraph.arrows2.sharpArrow'
  417. };
  418. mxShapeArrows2SharpArrow.prototype.customProperties = [
  419. {name: 'dx1', dispName: 'Arrowhead Arrow Width', type: 'float', min:0, defVal:18},
  420. {name: 'dy1', dispName: 'Arrow Arrow Width', type: 'float', min:0, max:1, defVal:0.67},
  421. {name: 'dx2', dispName: 'Arrowhead Angle', type: 'float', min:0, defVal:18},
  422. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal:0}
  423. ];
  424. /**
  425. * Function: paintVertexShape
  426. *
  427. * Paints the vertex shape.
  428. */
  429. mxShapeArrows2SharpArrow.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 notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  436. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  437. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  438. var x2 = 0;
  439. if (h != 0)
  440. {
  441. x2 = dx1a + dx2 * dy1a * 2 / h;
  442. }
  443. c.begin();
  444. c.moveTo(0, dy1);
  445. c.lineTo(w - dx1, dy1);
  446. c.lineTo(w - x2, 0);
  447. c.lineTo(w - dx2, 0);
  448. c.lineTo(w, h * 0.5);
  449. c.lineTo(w - dx2, h);
  450. c.lineTo(w - x2, h);
  451. c.lineTo(w - dx1, h - dy1);
  452. c.lineTo(0, h - dy1);
  453. c.lineTo(notch, h * 0.5);
  454. c.close();
  455. c.fillAndStroke();
  456. };
  457. mxCellRenderer.registerShape(mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW, mxShapeArrows2SharpArrow);
  458. mxShapeArrows2SharpArrow.prototype.constraints = null;
  459. Graph.handleFactory[mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW] = function(state)
  460. {
  461. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  462. {
  463. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  464. var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  465. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);
  466. }, function(bounds, pt)
  467. {
  468. 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;
  469. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  470. })];
  471. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  472. {
  473. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  474. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  475. }, function(bounds, pt)
  476. {
  477. 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;
  478. });
  479. handles.push(handle2);
  480. var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
  481. {
  482. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  483. return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);
  484. }, function(bounds, pt)
  485. {
  486. 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;
  487. });
  488. handles.push(handle3);
  489. return handles;
  490. };
  491. mxShapeArrows2SharpArrow.prototype.getConstraints = function(style, w, h)
  492. {
  493. var constr = [];
  494. var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  495. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  496. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  497. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  498. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  499. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  500. var x2 = 0;
  501. if (h != 0)
  502. {
  503. x2 = dx1a + dx2 * dy1a * 2 / h;
  504. }
  505. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  506. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  507. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy1));
  508. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, dy1));
  509. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - x2, 0));
  510. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx2, 0));
  511. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy1));
  512. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h - dy1));
  513. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - x2, h));
  514. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx2, h));
  515. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1) * 0.5, dy1));
  516. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1) * 0.5, h - dy1));
  517. return (constr);
  518. };
  519. //**********************************************************************************************************************************************************
  520. //Sharp Arrow2
  521. //**********************************************************************************************************************************************************
  522. /**
  523. * Extends mxShape.
  524. */
  525. function mxShapeArrows2SharpArrow2(bounds, fill, stroke, strokewidth)
  526. {
  527. mxShape.call(this);
  528. this.bounds = bounds;
  529. this.fill = fill;
  530. this.stroke = stroke;
  531. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  532. this.dy1 = 0.5;
  533. this.dx1 = 0.5;
  534. this.dx2 = 0.5;
  535. this.dy3 = 0.5;
  536. this.dx3 = 0.5;
  537. this.notch = 0;
  538. };
  539. /**
  540. * Extends mxShape.
  541. */
  542. mxUtils.extend(mxShapeArrows2SharpArrow2, mxActor);
  543. mxShapeArrows2SharpArrow2.prototype.customProperties = [
  544. {name: 'dx1', dispName: 'Arrowhead Arrow Width', type: 'float', min:0, defVal:18},
  545. {name: 'dy1', dispName: 'Arrow Width', type: 'float', min:0, max:1, defVal:0.67},
  546. {name: 'dx2', dispName: 'Arrowhead Angle', type: 'float', min:0, defVal:18},
  547. {name: 'dx3', dispName: 'Arrowhead Edge X', type: 'float', min:0, defVal:27},
  548. {name: 'dy3', dispName: 'Arrowhead Edge Y', type: 'float', min:0, max:1, defVal:0.15},
  549. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal:0}
  550. ];
  551. mxShapeArrows2SharpArrow2.prototype.cst = {
  552. SHARP_ARROW2 : 'mxgraph.arrows2.sharpArrow2'
  553. };
  554. /**
  555. * Function: paintVertexShape
  556. *
  557. * Paints the vertex shape.
  558. */
  559. mxShapeArrows2SharpArrow2.prototype.paintVertexShape = function(c, x, y, w, h)
  560. {
  561. c.translate(x, y);
  562. var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  563. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  564. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  565. var dy3 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy3', this.dy3))));
  566. var dx3 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx3', this.dx3))));
  567. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  568. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  569. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  570. c.begin();
  571. c.moveTo(0, dy1);
  572. c.lineTo(w - dx1, dy1);
  573. c.lineTo(w - dx3, dy3);
  574. c.lineTo(w - dx2, 0);
  575. c.lineTo(w, h * 0.5);
  576. c.lineTo(w - dx2, h);
  577. c.lineTo(w - dx3, h - dy3);
  578. c.lineTo(w - dx1, h - dy1);
  579. c.lineTo(0, h - dy1);
  580. c.lineTo(notch, h * 0.5);
  581. c.close();
  582. c.fillAndStroke();
  583. };
  584. mxCellRenderer.registerShape(mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2, mxShapeArrows2SharpArrow2);
  585. mxShapeArrows2SharpArrow2.prototype.constraints = null;
  586. Graph.handleFactory[mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2] = function(state)
  587. {
  588. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  589. {
  590. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  591. var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  592. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);
  593. }, function(bounds, pt)
  594. {
  595. 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;
  596. this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  597. })];
  598. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  599. {
  600. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  601. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  602. }, function(bounds, pt)
  603. {
  604. 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;
  605. });
  606. handles.push(handle2);
  607. var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
  608. {
  609. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  610. return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);
  611. }, function(bounds, pt)
  612. {
  613. 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;
  614. });
  615. handles.push(handle3);
  616. var handle4 = Graph.createHandle(state, ['dx3', 'dy3'], function(bounds)
  617. {
  618. var dx3 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx3', this.dx3))));
  619. 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))));
  620. return new mxPoint(bounds.x + bounds.width - dx3, bounds.y + dy3 * bounds.height / 2);
  621. }, function(bounds, pt)
  622. {
  623. 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;
  624. 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;
  625. });
  626. handles.push(handle4);
  627. return handles;
  628. };
  629. mxShapeArrows2SharpArrow2.prototype.getConstraints = function(style, w, h)
  630. {
  631. var constr = [];
  632. var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  633. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  634. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  635. var dy3 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy3', this.dy3))));
  636. var dx3 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx3', this.dx3))));
  637. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  638. var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  639. var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  640. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  641. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  642. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy1));
  643. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, dy1));
  644. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx3, dy3));
  645. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx2, 0));
  646. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy1));
  647. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h - dy1));
  648. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx3, h - dy3));
  649. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx2, h));
  650. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1) * 0.5, dy1));
  651. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1) * 0.5, h - dy1));
  652. return (constr);
  653. };
  654. //**********************************************************************************************************************************************************
  655. //Callout Arrow
  656. //**********************************************************************************************************************************************************
  657. /**
  658. * Extends mxShape.
  659. */
  660. function mxShapeArrows2CalloutArrow(bounds, fill, stroke, strokewidth)
  661. {
  662. mxShape.call(this);
  663. this.bounds = bounds;
  664. this.fill = fill;
  665. this.stroke = stroke;
  666. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  667. this.dy = 0.5;
  668. this.dx = 0.5;
  669. this.notch = 0;
  670. this.arrowHead = 0;
  671. };
  672. /**
  673. * Extends mxShape.
  674. */
  675. mxUtils.extend(mxShapeArrows2CalloutArrow, mxActor);
  676. mxShapeArrows2CalloutArrow.prototype.customProperties = [
  677. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  678. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:10},
  679. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:10},
  680. {name: 'notch', dispName: 'Rectangle Width', type: 'float', min:0, defVal:60}
  681. ];
  682. mxShapeArrows2CalloutArrow.prototype.cst = {
  683. CALLOUT_ARROW : 'mxgraph.arrows2.calloutArrow'
  684. };
  685. /**
  686. * Function: paintVertexShape
  687. *
  688. * Paints the vertex shape.
  689. */
  690. mxShapeArrows2CalloutArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  691. {
  692. c.translate(x, y);
  693. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  694. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  695. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  696. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  697. c.begin();
  698. c.moveTo(0, 0);
  699. c.lineTo(notch, 0);
  700. c.lineTo(notch, h * 0.5 - dy);
  701. c.lineTo(w - dx, h * 0.5 - dy);
  702. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  703. c.lineTo(w, h * 0.5);
  704. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  705. c.lineTo(w - dx, h * 0.5 + dy);
  706. c.lineTo(notch, h * 0.5 + dy);
  707. c.lineTo(notch, h);
  708. c.lineTo(0, h);
  709. c.close();
  710. c.fillAndStroke();
  711. };
  712. mxCellRenderer.registerShape(mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW, mxShapeArrows2CalloutArrow);
  713. mxShapeArrows2CalloutArrow.prototype.constraints = null;
  714. Graph.handleFactory[mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW] = function(state)
  715. {
  716. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  717. {
  718. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  719. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  720. var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  721. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  722. }, function(bounds, pt)
  723. {
  724. 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;
  725. 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;
  726. })];
  727. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  728. {
  729. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  730. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  731. }, function(bounds, pt)
  732. {
  733. 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;
  734. });
  735. handles.push(handle2);
  736. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  737. {
  738. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  739. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  740. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  741. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  742. }, function(bounds, pt)
  743. {
  744. 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;
  745. });
  746. handles.push(handle3);
  747. return handles;
  748. };
  749. mxShapeArrows2CalloutArrow.prototype.getConstraints = function(style, w, h)
  750. {
  751. var constr = [];
  752. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  753. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  754. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  755. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  756. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  757. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch, 0));
  758. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null,notch, h * 0.5 - dy));
  759. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 - dy));
  760. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 - dy - arrowHead));
  761. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.5));
  762. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 + dy + arrowHead));
  763. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 + dy));
  764. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch, h * 0.5 + dy));
  765. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch, h));
  766. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h));
  767. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch * 0.5 , 0));
  768. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch * 0.5 , h));
  769. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, (notch + w - dx) * 0.5, -dy));
  770. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, (notch + w - dx) * 0.5, dy));
  771. return (constr);
  772. };
  773. //**********************************************************************************************************************************************************
  774. //Bend Arrow
  775. //**********************************************************************************************************************************************************
  776. /**
  777. * Extends mxShape.
  778. */
  779. function mxShapeArrows2BendArrow(bounds, fill, stroke, strokewidth)
  780. {
  781. mxShape.call(this);
  782. this.bounds = bounds;
  783. this.fill = fill;
  784. this.stroke = stroke;
  785. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  786. this.dy = 0.5;
  787. this.dx = 0.5;
  788. this.notch = 0;
  789. this.arrowHead = 40;
  790. };
  791. /**
  792. * Extends mxShape.
  793. */
  794. mxUtils.extend(mxShapeArrows2BendArrow, mxActor);
  795. mxShapeArrows2BendArrow.prototype.customProperties = [
  796. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal: 38},
  797. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal: 15},
  798. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal: 0},
  799. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:55},
  800. {name: 'rounded', dispName: 'Rounded', type: 'boolean', defVal: false}
  801. ];
  802. mxShapeArrows2BendArrow.prototype.cst = {
  803. BEND_ARROW : 'mxgraph.arrows2.bendArrow'
  804. };
  805. /**
  806. * Function: paintVertexShape
  807. *
  808. * Paints the vertex shape.
  809. */
  810. mxShapeArrows2BendArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  811. {
  812. c.translate(x, y);
  813. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  814. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  815. var notch = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  816. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  817. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  818. c.begin();
  819. c.moveTo(w - dx, 0);
  820. c.lineTo(w, arrowHead * 0.5);
  821. c.lineTo(w - dx, arrowHead);
  822. c.lineTo(w - dx, arrowHead / 2 + dy);
  823. if (rounded == '1')
  824. {
  825. c.lineTo(dy * 2.2, arrowHead / 2 + dy);
  826. c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, dy * 2, arrowHead / 2 + dy * 1.2);
  827. }
  828. else
  829. {
  830. c.lineTo(dy * 2, arrowHead / 2 + dy);
  831. }
  832. c.lineTo(dy * 2, h);
  833. c.lineTo(dy, h - notch);
  834. c.lineTo(0, h);
  835. if (rounded == '1')
  836. {
  837. c.lineTo(0, arrowHead / 2 + dy);
  838. c.arcTo(dy * 2, dy * 2, 0, 0, 1, dy * 2, arrowHead / 2 - dy);
  839. }
  840. else
  841. {
  842. c.lineTo(0, arrowHead / 2 - dy);
  843. }
  844. c.lineTo(w - dx, arrowHead / 2 - dy);
  845. c.close();
  846. c.fillAndStroke();
  847. };
  848. mxCellRenderer.registerShape(mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW, mxShapeArrows2BendArrow);
  849. mxShapeArrows2BendArrow.prototype.constraints = null;
  850. Graph.handleFactory[mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW] = function(state)
  851. {
  852. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  853. {
  854. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  855. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  856. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  857. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  858. }, function(bounds, pt)
  859. {
  860. 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;
  861. 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;
  862. })];
  863. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  864. {
  865. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  866. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  867. var notch = Math.max(0, Math.min(bounds.height - arrowHead / 2 - dy, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  868. return new mxPoint(bounds.x + dy, bounds.y + bounds.height - notch);
  869. }, function(bounds, pt)
  870. {
  871. 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;
  872. });
  873. handles.push(handle2);
  874. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  875. {
  876. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  877. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  878. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  879. }, function(bounds, pt)
  880. {
  881. 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;
  882. });
  883. handles.push(handle3);
  884. return handles;
  885. };
  886. mxShapeArrows2BendArrow.prototype.getConstraints = function(style, w, h)
  887. {
  888. var constr = [];
  889. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  890. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  891. var notch = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  892. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  893. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  894. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx + dy * 2) * 0.5, arrowHead / 2 - dy));
  895. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead / 2 - dy));
  896. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
  897. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, arrowHead * 0.5));
  898. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead));
  899. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead / 2 + dy));
  900. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx + dy * 2) * 0.5, arrowHead / 2 + dy));
  901. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dy * 2, (h - arrowHead / 2 - dy) * 0.5 + arrowHead / 2 + dy));
  902. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dy * 2, h));
  903. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dy, h - notch));
  904. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h));
  905. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - arrowHead / 2 - dy) * 0.5 + arrowHead / 2 + dy));
  906. if (rounded == '1')
  907. {
  908. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dy * 0.586, arrowHead / 2 - dy * 0.414));
  909. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2 * dy + dy * 0.0586, arrowHead / 2 + dy + dy * 0.0586));
  910. }
  911. else
  912. {
  913. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, arrowHead / 2 - dy));
  914. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dy * 2, arrowHead / 2 + dy));
  915. }
  916. return (constr);
  917. };
  918. //**********************************************************************************************************************************************************
  919. //Bend Double Arrow
  920. //**********************************************************************************************************************************************************
  921. /**
  922. * Extends mxShape.
  923. */
  924. function mxShapeArrows2BendDoubleArrow(bounds, fill, stroke, strokewidth)
  925. {
  926. mxShape.call(this);
  927. this.bounds = bounds;
  928. this.fill = fill;
  929. this.stroke = stroke;
  930. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  931. this.dy = 0.5;
  932. this.dx = 0.5;
  933. this.notch = 0;
  934. this.arrowHead = 40;
  935. };
  936. /**
  937. * Extends mxShape.
  938. */
  939. mxUtils.extend(mxShapeArrows2BendDoubleArrow, mxActor);
  940. mxShapeArrows2BendDoubleArrow.prototype.customProperties = [
  941. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:38},
  942. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:15},
  943. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:55},
  944. {name: 'rounded', dispName: 'Rounded', type: 'boolean', defVal:false}
  945. ];
  946. mxShapeArrows2BendDoubleArrow.prototype.cst = {
  947. BEND_DOUBLE_ARROW : 'mxgraph.arrows2.bendDoubleArrow'
  948. };
  949. /**
  950. * Function: paintVertexShape
  951. *
  952. * Paints the vertex shape.
  953. */
  954. mxShapeArrows2BendDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  955. {
  956. c.translate(x, y);
  957. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  958. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  959. var arrowHead = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  960. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  961. c.begin();
  962. c.moveTo(w - dx, 0);
  963. c.lineTo(w, arrowHead * 0.5);
  964. c.lineTo(w - dx, arrowHead);
  965. c.lineTo(w - dx, arrowHead / 2 + dy);
  966. if (rounded == '1')
  967. {
  968. c.lineTo(arrowHead / 2 + dy * 1.2, arrowHead / 2 + dy);
  969. c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, arrowHead /2 + dy, arrowHead / 2 + dy * 1.2);
  970. }
  971. else
  972. {
  973. c.lineTo(arrowHead / 2 + dy, arrowHead / 2 + dy);
  974. }
  975. c.lineTo(arrowHead / 2 + dy, h - dx);
  976. c.lineTo(arrowHead, h - dx);
  977. c.lineTo(arrowHead / 2, h);
  978. c.lineTo(0, h - dx);
  979. c.lineTo(arrowHead / 2 - dy, h - dx);
  980. if (rounded == '1')
  981. {
  982. c.lineTo(arrowHead / 2 - dy, arrowHead / 2 + dy);
  983. c.arcTo(dy * 2, dy * 2, 0, 0, 1, arrowHead / 2 + dy, arrowHead / 2 - dy);
  984. }
  985. else
  986. {
  987. c.lineTo(arrowHead / 2 - dy, arrowHead / 2 - dy);
  988. }
  989. c.lineTo(w - dx, arrowHead / 2 - dy);
  990. c.close();
  991. c.fillAndStroke();
  992. };
  993. mxCellRenderer.registerShape(mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW, mxShapeArrows2BendDoubleArrow);
  994. mxShapeArrows2BendDoubleArrow.prototype.constraints = null;
  995. Graph.handleFactory[mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW] = function(state)
  996. {
  997. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  998. {
  999. 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))));
  1000. var dx = Math.max(0, Math.min(Math.min(bounds.width, bounds.height) - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1001. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1002. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  1003. }, function(bounds, pt)
  1004. {
  1005. 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;
  1006. 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;
  1007. })];
  1008. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1009. {
  1010. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1011. var arrowHead = Math.max(0, Math.min(Math.min(bounds.height, bounds.width) - dx, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1012. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  1013. }, function(bounds, pt)
  1014. {
  1015. 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;
  1016. });
  1017. handles.push(handle2);
  1018. return handles;
  1019. };
  1020. mxShapeArrows2BendDoubleArrow.prototype.getConstraints = function(style, w, h)
  1021. {
  1022. var constr = [];
  1023. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1024. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1025. var arrowHead = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1026. var rounded = mxUtils.getValue(this.style, 'rounded', '0');
  1027. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx , 0));
  1028. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, arrowHead * 0.5));
  1029. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead));
  1030. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead / 2 + dy));
  1031. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (arrowHead / 2 + dy + w - dx) * 0.5, arrowHead / 2 + dy));
  1032. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (arrowHead / 2 + dy + w - dx) * 0.5, arrowHead / 2 - dy));
  1033. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 + dy, (arrowHead / 2 + dy + h - dx) * 0.5));
  1034. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 - dy, (arrowHead / 2 + dy + h - dx) * 0.5));
  1035. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 + dy, h - dx));
  1036. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead, h - dx));
  1037. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2, h));
  1038. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dx));
  1039. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 - dy, h - dx));
  1040. if (rounded == '1')
  1041. {
  1042. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 - dy * 0.414, arrowHead / 2 - dy * 0.414));
  1043. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 + dy + dy * 0.0586, arrowHead / 2 + dy + dy * 0.0586));
  1044. }
  1045. else
  1046. {
  1047. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 - dy, arrowHead / 2 - dy));
  1048. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead / 2 + dy, arrowHead / 2 + dy));
  1049. }
  1050. return (constr);
  1051. };
  1052. //**********************************************************************************************************************************************************
  1053. //Callout Double Arrow
  1054. //**********************************************************************************************************************************************************
  1055. /**
  1056. * Extends mxShape.
  1057. */
  1058. function mxShapeArrows2CalloutDoubleArrow(bounds, fill, stroke, strokewidth)
  1059. {
  1060. mxShape.call(this);
  1061. this.bounds = bounds;
  1062. this.fill = fill;
  1063. this.stroke = stroke;
  1064. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1065. this.dy = 0.5;
  1066. this.dx = 0.5;
  1067. this.notch = 0;
  1068. this.arrowHead = 0;
  1069. };
  1070. /**
  1071. * Extends mxShape.
  1072. */
  1073. mxUtils.extend(mxShapeArrows2CalloutDoubleArrow, mxActor);
  1074. mxShapeArrows2CalloutDoubleArrow.prototype.customProperties = [
  1075. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  1076. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:10},
  1077. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:10},
  1078. {name: 'notch', dispName: 'Rect Size', type: 'float', min:0, defVal:24}
  1079. ];
  1080. mxShapeArrows2CalloutDoubleArrow.prototype.cst = {
  1081. CALLOUT_DOUBLE_ARROW : 'mxgraph.arrows2.calloutDoubleArrow'
  1082. };
  1083. /**
  1084. * Function: paintVertexShape
  1085. *
  1086. * Paints the vertex shape.
  1087. */
  1088. mxShapeArrows2CalloutDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1089. {
  1090. c.translate(x, y);
  1091. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1092. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1093. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1094. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1095. c.begin();
  1096. c.moveTo(w / 2 - notch, 0);
  1097. c.lineTo(w / 2 + notch, 0);
  1098. c.lineTo(w / 2 + notch, h * 0.5 - dy);
  1099. c.lineTo(w - dx, h * 0.5 - dy);
  1100. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  1101. c.lineTo(w, h * 0.5);
  1102. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  1103. c.lineTo(w - dx, h * 0.5 + dy);
  1104. c.lineTo(w / 2 + notch, h * 0.5 + dy);
  1105. c.lineTo(w / 2 + notch, h);
  1106. c.lineTo(w / 2 - notch, h);
  1107. c.lineTo(w / 2 - notch, h * 0.5 + dy);
  1108. c.lineTo(dx, h * 0.5 + dy);
  1109. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  1110. c.lineTo(0, h * 0.5);
  1111. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  1112. c.lineTo(dx, h * 0.5 - dy);
  1113. c.lineTo(w / 2 - notch, h * 0.5 - dy);
  1114. c.close();
  1115. c.fillAndStroke();
  1116. };
  1117. mxCellRenderer.registerShape(mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW, mxShapeArrows2CalloutDoubleArrow);
  1118. mxShapeArrows2CalloutDoubleArrow.prototype.constraints = null;
  1119. Graph.handleFactory[mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW] = function(state)
  1120. {
  1121. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1122. {
  1123. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1124. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1125. var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1126. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  1127. }, function(bounds, pt)
  1128. {
  1129. 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;
  1130. 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;
  1131. })];
  1132. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1133. {
  1134. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1135. return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);
  1136. }, function(bounds, pt)
  1137. {
  1138. 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;
  1139. });
  1140. handles.push(handle2);
  1141. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1142. {
  1143. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1144. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1145. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1146. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  1147. }, function(bounds, pt)
  1148. {
  1149. 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;
  1150. });
  1151. handles.push(handle3);
  1152. return handles;
  1153. };
  1154. mxShapeArrows2CalloutDoubleArrow.prototype.getConstraints = function(style, w, h)
  1155. {
  1156. var constr = [];
  1157. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1158. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1159. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1160. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1161. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1162. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1163. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1164. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1165. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 2 - notch, 0));
  1166. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 2 + notch, 0));
  1167. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, w / 2 - notch, 0));
  1168. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, w / 2 + notch, 0));
  1169. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 - dy - arrowHead));
  1170. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 + dy + arrowHead));
  1171. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 - dy - arrowHead));
  1172. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 + dy + arrowHead));
  1173. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx + notch) * 0.5, h * 0.5 - dy));
  1174. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx + notch) * 0.5, h * 0.5 + dy));
  1175. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 0.5 + dx - notch) * 0.5, h * 0.5 - dy));
  1176. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 0.5 + dx - notch) * 0.5, h * 0.5 + dy));
  1177. return (constr);
  1178. };
  1179. //**********************************************************************************************************************************************************
  1180. //Callout Quad Arrow
  1181. //**********************************************************************************************************************************************************
  1182. /**
  1183. * Extends mxShape.
  1184. */
  1185. function mxShapeArrows2CalloutQuadArrow(bounds, fill, stroke, strokewidth)
  1186. {
  1187. mxShape.call(this);
  1188. this.bounds = bounds;
  1189. this.fill = fill;
  1190. this.stroke = stroke;
  1191. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1192. this.dy = 0.5;
  1193. this.dx = 0.5;
  1194. this.notch = 0;
  1195. this.arrowHead = 0;
  1196. };
  1197. /**
  1198. * Extends mxShape.
  1199. */
  1200. mxUtils.extend(mxShapeArrows2CalloutQuadArrow, mxActor);
  1201. mxShapeArrows2CalloutQuadArrow.prototype.customProperties = [
  1202. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  1203. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal: 10},
  1204. {name: 'notch', dispName: 'Rect Size', type: 'float', min:0, defVal:24},
  1205. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:10}
  1206. ];
  1207. mxShapeArrows2CalloutQuadArrow.prototype.cst = {
  1208. CALLOUT_QUAD_ARROW : 'mxgraph.arrows2.calloutQuadArrow'
  1209. };
  1210. /**
  1211. * Function: paintVertexShape
  1212. *
  1213. * Paints the vertex shape.
  1214. */
  1215. mxShapeArrows2CalloutQuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1216. {
  1217. c.translate(x, y);
  1218. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1219. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1220. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1221. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1222. c.begin();
  1223. c.moveTo(w * 0.5 + dy, h * 0.5 - notch);
  1224. c.lineTo(w * 0.5 + notch, h * 0.5 - notch);
  1225. c.lineTo(w * 0.5 + notch, h * 0.5 - dy);
  1226. c.lineTo(w - dx, h * 0.5 - dy);
  1227. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  1228. c.lineTo(w, h * 0.5);
  1229. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  1230. c.lineTo(w - dx, h * 0.5 + dy);
  1231. c.lineTo(w * 0.5 + notch, h * 0.5 + dy);
  1232. c.lineTo(w * 0.5 + notch, h * 0.5 + notch);
  1233. c.lineTo(w * 0.5 + dy, h * 0.5 + notch);
  1234. c.lineTo(w * 0.5 + dy, h - dx);
  1235. c.lineTo(w * 0.5 + dy + arrowHead, h - dx);
  1236. c.lineTo(w * 0.5, h);
  1237. c.lineTo(w * 0.5 - dy - arrowHead, h - dx);
  1238. c.lineTo(w * 0.5 - dy, h - dx);
  1239. c.lineTo(w * 0.5 - dy, h * 0.5 + notch);
  1240. c.lineTo(w * 0.5 - notch, h * 0.5 + notch);
  1241. c.lineTo(w * 0.5 - notch, h * 0.5 + dy);
  1242. c.lineTo(dx, h * 0.5 + dy);
  1243. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  1244. c.lineTo(0, h * 0.5);
  1245. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  1246. c.lineTo(dx, h * 0.5 - dy);
  1247. c.lineTo(w * 0.5 - notch, h * 0.5 - dy);
  1248. c.lineTo(w * 0.5 - notch, h * 0.5 - notch);
  1249. c.lineTo(w * 0.5 - dy, h * 0.5 - notch);
  1250. c.lineTo(w * 0.5 - dy, dx);
  1251. c.lineTo(w * 0.5 - dy - arrowHead, dx);
  1252. c.lineTo(w * 0.5, 0);
  1253. c.lineTo(w * 0.5 + dy + arrowHead, dx);
  1254. c.lineTo(w * 0.5 + dy, dx);
  1255. c.close();
  1256. c.fillAndStroke();
  1257. };
  1258. mxCellRenderer.registerShape(mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW, mxShapeArrows2CalloutQuadArrow);
  1259. mxShapeArrows2CalloutQuadArrow.prototype.constraints = null;
  1260. Graph.handleFactory[mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW] = function(state)
  1261. {
  1262. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1263. {
  1264. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1265. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1266. var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1267. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  1268. }, function(bounds, pt)
  1269. {
  1270. 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;
  1271. 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;
  1272. })];
  1273. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1274. {
  1275. 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))));
  1276. return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);
  1277. }, function(bounds, pt)
  1278. {
  1279. 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;
  1280. });
  1281. handles.push(handle2);
  1282. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1283. {
  1284. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1285. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1286. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1287. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  1288. }, function(bounds, pt)
  1289. {
  1290. 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;
  1291. });
  1292. handles.push(handle3);
  1293. return handles;
  1294. };
  1295. mxShapeArrows2CalloutQuadArrow.prototype.getConstraints = function(style, w, h)
  1296. {
  1297. var constr = [];
  1298. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1299. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1300. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1301. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1302. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1303. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1304. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1305. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1306. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, h * 0.5 - notch));
  1307. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + notch, h * 0.5 - notch));
  1308. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + notch, h * 0.5 - dy));
  1309. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, h * 0.5 + notch));
  1310. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + notch, h * 0.5 + notch));
  1311. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + notch, h * 0.5 + dy));
  1312. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, h * 0.5 + notch));
  1313. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - notch, h * 0.5 + notch));
  1314. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - notch, h * 0.5 + dy));
  1315. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, h * 0.5 - notch));
  1316. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - notch, h * 0.5 - notch));
  1317. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - notch, h * 0.5 - dy));
  1318. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 - dy - arrowHead));
  1319. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 + dy + arrowHead));
  1320. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy - arrowHead, h - dx));
  1321. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy + arrowHead, h - dx));
  1322. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 - dy - arrowHead));
  1323. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 + dy + arrowHead));
  1324. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy - arrowHead, dx));
  1325. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy + arrowHead, dx));
  1326. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75 + (notch - dx) * 0.5, h * 0.5 - dy));
  1327. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75 + (notch - dx) * 0.5, h * 0.5 + dy));
  1328. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, h * 0.75 + (notch - dx) * 0.5));
  1329. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, h * 0.75 + (notch - dx) * 0.5));
  1330. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25 - (notch - dx) * 0.5, h * 0.5 - dy));
  1331. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25 - (notch - dx) * 0.5, h * 0.5 + dy));
  1332. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, h * 0.25 - (notch - dx) * 0.5));
  1333. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, h * 0.25 - (notch - dx) * 0.5));
  1334. return (constr);
  1335. };
  1336. //**********************************************************************************************************************************************************
  1337. //Callout Double 90 Arrow
  1338. //**********************************************************************************************************************************************************
  1339. /**
  1340. * Extends mxShape.
  1341. */
  1342. function mxShapeArrows2CalloutDouble90Arrow(bounds, fill, stroke, strokewidth)
  1343. {
  1344. mxShape.call(this);
  1345. this.bounds = bounds;
  1346. this.fill = fill;
  1347. this.stroke = stroke;
  1348. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1349. this.dy1 = 0.5;
  1350. this.dx1 = 0.5;
  1351. this.dx2 = 0;
  1352. this.dy2 = 0;
  1353. this.arrowHead = 0;
  1354. };
  1355. /**
  1356. * Extends mxShape.
  1357. */
  1358. mxUtils.extend(mxShapeArrows2CalloutDouble90Arrow, mxActor);
  1359. mxShapeArrows2CalloutDouble90Arrow.prototype.customProperties = [
  1360. {name: 'dx1', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  1361. {name: 'dy1', dispName: 'Arrow Width', type: 'float', min:0, defVal: 10},
  1362. {name: 'dx2', dispName: 'Callout Width', type: 'float', min:0, defVal:70},
  1363. {name: 'dy2', dispName: 'Callout Height', type: 'float', min:0, defVal:70},
  1364. {name: 'arrowHead', dispName: 'ArrowHead Width', type: 'float', min:0, defVal:10}
  1365. ];
  1366. mxShapeArrows2CalloutDouble90Arrow.prototype.cst = {
  1367. CALLOUT_DOUBLE_90_ARROW : 'mxgraph.arrows2.calloutDouble90Arrow'
  1368. };
  1369. /**
  1370. * Function: paintVertexShape
  1371. *
  1372. * Paints the vertex shape.
  1373. */
  1374. mxShapeArrows2CalloutDouble90Arrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1375. {
  1376. c.translate(x, y);
  1377. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1378. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1379. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1380. var dy2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1381. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1382. c.begin();
  1383. c.moveTo(0, 0);
  1384. c.lineTo(dx2, 0);
  1385. c.lineTo(dx2, dy2 * 0.5 - dy1);
  1386. c.lineTo(w - dx1, dy2 * 0.5 - dy1);
  1387. c.lineTo(w - dx1, dy2 * 0.5 - dy1 - arrowHead);
  1388. c.lineTo(w, dy2 * 0.5);
  1389. c.lineTo(w - dx1, dy2 * 0.5 + dy1 + arrowHead);
  1390. c.lineTo(w - dx1, dy2 * 0.5 + dy1);
  1391. c.lineTo(dx2, dy2 * 0.5 + dy1);
  1392. c.lineTo(dx2, dy2);
  1393. c.lineTo(dx2 / 2 + dy1, dy2);
  1394. c.lineTo(dx2 / 2 + dy1, h - dx1);
  1395. c.lineTo(dx2 / 2 + dy1 + arrowHead, h - dx1);
  1396. c.lineTo(dx2 / 2, h);
  1397. c.lineTo(dx2 / 2 - dy1 - arrowHead, h - dx1);
  1398. c.lineTo(dx2 / 2 - dy1, h - dx1);
  1399. c.lineTo(dx2 / 2 - dy1, dy2);
  1400. c.lineTo(0, dy2);
  1401. c.close();
  1402. c.fillAndStroke();
  1403. };
  1404. mxCellRenderer.registerShape(mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW, mxShapeArrows2CalloutDouble90Arrow);
  1405. mxShapeArrows2CalloutDouble90Arrow.prototype.constraints = null;
  1406. Graph.handleFactory[mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW] = function(state)
  1407. {
  1408. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  1409. {
  1410. 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))));
  1411. 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))));
  1412. 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))));
  1413. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1);
  1414. }, function(bounds, pt)
  1415. {
  1416. 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;
  1417. 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;
  1418. })];
  1419. var handle2 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  1420. {
  1421. 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))));
  1422. 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))));
  1423. return new mxPoint(bounds.x + dx2, bounds.y + dy2);
  1424. }, function(bounds, pt)
  1425. {
  1426. 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;
  1427. 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;
  1428. });
  1429. handles.push(handle2);
  1430. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1431. {
  1432. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1433. 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))));
  1434. 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))));
  1435. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1 - arrowHead);
  1436. }, function(bounds, pt)
  1437. {
  1438. 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;
  1439. });
  1440. handles.push(handle3);
  1441. return handles;
  1442. };
  1443. mxShapeArrows2CalloutDouble90Arrow.prototype.getConstraints = function(style, w, h)
  1444. {
  1445. var constr = [];
  1446. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1447. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1448. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1449. var dy2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1450. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1451. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  1452. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 * 0.5, 0));
  1453. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, 0));
  1454. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + dx2) * 0.5, dy2 * 0.5 - dy1));
  1455. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, dy2 * 0.5 - dy1 - arrowHead));
  1456. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy2 * 0.5));
  1457. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, dy2 * 0.5 + dy1 + arrowHead));
  1458. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + dx2) * 0.5, dy2 * 0.5 + dy1));
  1459. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, dy2));
  1460. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 * 0.5 + dy1, (h - dx1 + dy2) * 0.5));
  1461. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 * 0.5 - dy1, (h - dx1 + dy2) * 0.5));
  1462. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 / 2 + dy1 + arrowHead, h - dx1));
  1463. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 / 2, h));
  1464. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 / 2 - dy1 - arrowHead, h - dx1));
  1465. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy2));
  1466. return (constr);
  1467. };
  1468. //**********************************************************************************************************************************************************
  1469. //Quad Arrow
  1470. //**********************************************************************************************************************************************************
  1471. /**
  1472. * Extends mxShape.
  1473. */
  1474. function mxShapeArrows2QuadArrow(bounds, fill, stroke, strokewidth)
  1475. {
  1476. mxShape.call(this);
  1477. this.bounds = bounds;
  1478. this.fill = fill;
  1479. this.stroke = stroke;
  1480. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1481. this.dy = 0.5;
  1482. this.dx = 0.5;
  1483. this.notch = 0;
  1484. this.arrowHead = 0;
  1485. };
  1486. /**
  1487. * Extends mxShape.
  1488. */
  1489. mxUtils.extend(mxShapeArrows2QuadArrow, mxActor);
  1490. mxShapeArrows2QuadArrow.prototype.customProperties = [
  1491. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  1492. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:10},
  1493. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:10}
  1494. ];
  1495. mxShapeArrows2QuadArrow.prototype.cst = {
  1496. QUAD_ARROW : 'mxgraph.arrows2.quadArrow'
  1497. };
  1498. /**
  1499. * Function: paintVertexShape
  1500. *
  1501. * Paints the vertex shape.
  1502. */
  1503. mxShapeArrows2QuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1504. {
  1505. c.translate(x, y);
  1506. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1507. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1508. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1509. c.begin();
  1510. c.moveTo(w * 0.5 + dy, h * 0.5 - dy);
  1511. c.lineTo(w - dx, h * 0.5 - dy);
  1512. c.lineTo(w - dx, h * 0.5 - dy - arrowHead);
  1513. c.lineTo(w, h * 0.5);
  1514. c.lineTo(w - dx, h * 0.5 + dy + arrowHead);
  1515. c.lineTo(w - dx, h * 0.5 + dy);
  1516. c.lineTo(w * 0.5 + dy, h * 0.5 + dy);
  1517. c.lineTo(w * 0.5 + dy, h - dx);
  1518. c.lineTo(w * 0.5 + dy + arrowHead, h - dx);
  1519. c.lineTo(w * 0.5, h);
  1520. c.lineTo(w * 0.5 - dy - arrowHead, h - dx);
  1521. c.lineTo(w * 0.5 - dy, h - dx);
  1522. c.lineTo(w * 0.5 - dy, h * 0.5 + dy);
  1523. c.lineTo(dx, h * 0.5 + dy);
  1524. c.lineTo(dx, h * 0.5 + dy + arrowHead);
  1525. c.lineTo(0, h * 0.5);
  1526. c.lineTo(dx, h * 0.5 - dy - arrowHead);
  1527. c.lineTo(dx, h * 0.5 - dy);
  1528. c.lineTo(w * 0.5 - dy, h * 0.5 - dy);
  1529. c.lineTo(w * 0.5 - dy, dx);
  1530. c.lineTo(w * 0.5 - dy - arrowHead, dx);
  1531. c.lineTo(w * 0.5, 0);
  1532. c.lineTo(w * 0.5 + dy + arrowHead, dx);
  1533. c.lineTo(w * 0.5 + dy, dx);
  1534. c.close();
  1535. c.fillAndStroke();
  1536. };
  1537. mxCellRenderer.registerShape(mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW, mxShapeArrows2QuadArrow);
  1538. mxShapeArrows2QuadArrow.prototype.constraints = null;
  1539. Graph.handleFactory[mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW] = function(state)
  1540. {
  1541. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1542. {
  1543. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1544. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1545. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1546. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);
  1547. }, function(bounds, pt)
  1548. {
  1549. 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;
  1550. 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;
  1551. })];
  1552. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1553. {
  1554. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1555. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1556. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1557. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);
  1558. }, function(bounds, pt)
  1559. {
  1560. 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;
  1561. });
  1562. handles.push(handle2);
  1563. return handles;
  1564. };
  1565. mxShapeArrows2QuadArrow.prototype.getConstraints = function(style, w, h)
  1566. {
  1567. var constr = [];
  1568. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1569. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1570. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1571. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1572. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1573. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1574. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1575. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 - dy - arrowHead));
  1576. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h * 0.5 + dy + arrowHead));
  1577. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 - dy - arrowHead));
  1578. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h * 0.5 + dy + arrowHead));
  1579. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy - arrowHead, dx));
  1580. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy + arrowHead, dx));
  1581. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy - arrowHead, h - dx));
  1582. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy + arrowHead, h - dx));
  1583. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, (dx - dy) * 0.5 + h * 0.25));
  1584. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, (dx - dy) * 0.5 + h * 0.25));
  1585. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - dy, (dy - dx) * 0.5 + h * 0.75));
  1586. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + dy, (dy - dx) * 0.5 + h * 0.75));
  1587. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dx - dy) * 0.5 + w * 0.25, h * 0.5 - dy));
  1588. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dx - dy) * 0.5 + w * 0.25, h * 0.5 + dy));
  1589. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dy - dx) * 0.5 + w * 0.75, h * 0.5 - dy));
  1590. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dy - dx) * 0.5 + w * 0.75, h * 0.5 + dy));
  1591. return (constr);
  1592. };
  1593. //**********************************************************************************************************************************************************
  1594. //Triad Arrow
  1595. //**********************************************************************************************************************************************************
  1596. /**
  1597. * Extends mxShape.
  1598. */
  1599. function mxShapeArrows2TriadArrow(bounds, fill, stroke, strokewidth)
  1600. {
  1601. mxShape.call(this);
  1602. this.bounds = bounds;
  1603. this.fill = fill;
  1604. this.stroke = stroke;
  1605. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1606. this.dy = 0.5;
  1607. this.dx = 0.5;
  1608. this.arrowHead = 0;
  1609. };
  1610. /**
  1611. * Extends mxShape.
  1612. */
  1613. mxUtils.extend(mxShapeArrows2TriadArrow, mxActor);
  1614. mxShapeArrows2TriadArrow.prototype.customProperties = [
  1615. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:20},
  1616. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:10},
  1617. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:40}
  1618. ];
  1619. mxShapeArrows2TriadArrow.prototype.cst = {
  1620. TRIAD_ARROW : 'mxgraph.arrows2.triadArrow'
  1621. };
  1622. /**
  1623. * Function: paintVertexShape
  1624. *
  1625. * Paints the vertex shape.
  1626. */
  1627. mxShapeArrows2TriadArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1628. {
  1629. c.translate(x, y);
  1630. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1631. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1632. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1633. c.begin();
  1634. c.moveTo(w * 0.5 + arrowHead * 0.5 - dy, h - arrowHead + dy);
  1635. c.lineTo(w - dx, h - arrowHead + dy);
  1636. c.lineTo(w - dx, h - arrowHead);
  1637. c.lineTo(w, h - arrowHead * 0.5);
  1638. c.lineTo(w - dx, h);
  1639. c.lineTo(w - dx, h - dy);
  1640. c.lineTo(dx, h - dy);
  1641. c.lineTo(dx, h);
  1642. c.lineTo(0, h - arrowHead * 0.5);
  1643. c.lineTo(dx, h - arrowHead);
  1644. c.lineTo(dx, h - arrowHead + dy);
  1645. c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, h - arrowHead + dy);
  1646. c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, dx);
  1647. c.lineTo(w * 0.5 - arrowHead * 0.5, dx);
  1648. c.lineTo(w * 0.5, 0);
  1649. c.lineTo(w * 0.5 + arrowHead * 0.5, dx);
  1650. c.lineTo(w * 0.5 + arrowHead * 0.5 - dy, dx);
  1651. c.close();
  1652. c.fillAndStroke();
  1653. };
  1654. mxCellRenderer.registerShape(mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW, mxShapeArrows2TriadArrow);
  1655. mxShapeArrows2TriadArrow.prototype.constraints = null;
  1656. Graph.handleFactory[mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW] = function(state)
  1657. {
  1658. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  1659. {
  1660. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1661. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1662. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1663. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - dy);
  1664. }, function(bounds, pt)
  1665. {
  1666. 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;
  1667. 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;
  1668. })];
  1669. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1670. {
  1671. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  1672. var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  1673. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1674. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - arrowHead);
  1675. }, function(bounds, pt)
  1676. {
  1677. 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;
  1678. });
  1679. handles.push(handle2);
  1680. return handles;
  1681. };
  1682. mxShapeArrows2TriadArrow.prototype.getConstraints = function(style, w, h)
  1683. {
  1684. var constr = [];
  1685. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  1686. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  1687. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1688. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, - arrowHead * 0.5, dx));
  1689. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1690. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h - dy));
  1691. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, arrowHead * 0.5, dx));
  1692. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - arrowHead));
  1693. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - arrowHead * 0.5));
  1694. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h));
  1695. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h - arrowHead));
  1696. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - arrowHead * 0.5));
  1697. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
  1698. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx + arrowHead * 0.5 - dy) * 0.5, h - arrowHead + dy));
  1699. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx + arrowHead * 0.5 - dy) * 0.5, h - dy));
  1700. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 0.5 + dx - arrowHead * 0.5 + dy) * 0.5, h - arrowHead + dy));
  1701. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 0.5 + dx - arrowHead * 0.5 + dy) * 0.5, h - dy));
  1702. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - arrowHead * 0.5 + dy, (dx + h - arrowHead + dy) * 0.5));
  1703. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + arrowHead * 0.5 - dy, (dx + h - arrowHead + dy) * 0.5));
  1704. return (constr);
  1705. };
  1706. //**********************************************************************************************************************************************************
  1707. //Tailed Arrow
  1708. //**********************************************************************************************************************************************************
  1709. /**
  1710. * Extends mxShape.
  1711. */
  1712. function mxShapeArrows2TailedArrow(bounds, fill, stroke, strokewidth)
  1713. {
  1714. mxShape.call(this);
  1715. this.bounds = bounds;
  1716. this.fill = fill;
  1717. this.stroke = stroke;
  1718. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1719. this.dy = 0.5;
  1720. this.dx = 0.5;
  1721. this.notch = 0;
  1722. this.arrowHead = 0;
  1723. };
  1724. /**
  1725. * Extends mxShape.
  1726. */
  1727. mxUtils.extend(mxShapeArrows2TailedArrow, mxActor);
  1728. mxShapeArrows2TailedArrow.prototype.customProperties = [
  1729. {name: 'dx1', dispName: 'Arrowhead Length', type: 'float', min:0, defVal: 20},
  1730. {name: 'dy1', dispName: 'Arrow Width', type: 'float', min:0, defVal: 10},
  1731. {name: 'dx2', dispName: 'Tail Length', type: 'float', min:0, defVal: 25},
  1732. {name: 'dy2', dispName: 'Tail Width', type: 'float', min:0, defVal:30},
  1733. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal: 0},
  1734. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:20}
  1735. ];
  1736. mxShapeArrows2TailedArrow.prototype.cst = {
  1737. TAILED_ARROW : 'mxgraph.arrows2.tailedArrow'
  1738. };
  1739. /**
  1740. * Function: paintVertexShape
  1741. *
  1742. * Paints the vertex shape.
  1743. */
  1744. mxShapeArrows2TailedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1745. {
  1746. c.translate(x, y);
  1747. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1748. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1749. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1750. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1751. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1752. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1753. var x2 = 0;
  1754. if (dy2 != 0)
  1755. {
  1756. x2 = dx2 + dy2 * (dy2 - dy1) / dy2;
  1757. }
  1758. c.begin();
  1759. c.moveTo(0, h * 0.5 - dy2);
  1760. c.lineTo(dx2, h * 0.5 - dy2);
  1761. c.lineTo(x2, h * 0.5 - dy1);
  1762. c.lineTo(w - dx1, h * 0.5 - dy1);
  1763. c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);
  1764. c.lineTo(w, h * 0.5);
  1765. c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);
  1766. c.lineTo(w - dx1, h * 0.5 + dy1);
  1767. c.lineTo(x2, h * 0.5 + dy1);
  1768. c.lineTo(dx2, h * 0.5 + dy2);
  1769. c.lineTo(0, h * 0.5 + dy2);
  1770. c.lineTo(notch, h * 0.5);
  1771. c.close();
  1772. c.fillAndStroke();
  1773. };
  1774. mxCellRenderer.registerShape(mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW, mxShapeArrows2TailedArrow);
  1775. mxShapeArrows2TailedArrow.prototype.constraints = null;
  1776. Graph.handleFactory[mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW] = function(state)
  1777. {
  1778. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  1779. {
  1780. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1781. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1782. var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1783. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);
  1784. }, function(bounds, pt)
  1785. {
  1786. 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;
  1787. 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;
  1788. })];
  1789. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1790. {
  1791. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1792. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  1793. }, function(bounds, pt)
  1794. {
  1795. 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;
  1796. });
  1797. handles.push(handle2);
  1798. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1799. {
  1800. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1801. var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1802. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1803. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);
  1804. }, function(bounds, pt)
  1805. {
  1806. 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;
  1807. });
  1808. handles.push(handle3);
  1809. var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  1810. {
  1811. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  1812. var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
  1813. return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);
  1814. }, function(bounds, pt)
  1815. {
  1816. 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;
  1817. 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;
  1818. });
  1819. handles.push(handle4);
  1820. return handles;
  1821. };
  1822. mxShapeArrows2TailedArrow.prototype.getConstraints = function(style, w, h)
  1823. {
  1824. var constr = [];
  1825. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1826. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1827. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1828. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1829. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1830. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1831. var x2 = 0;
  1832. if (dy2 != 0)
  1833. {
  1834. x2 = dx2 + dy2 * (dy2 - dy1) / dy2;
  1835. }
  1836. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  1837. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5 - dy2));
  1838. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h * 0.5 - dy2));
  1839. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + x2) * 0.5, h * 0.5 - dy1));
  1840. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h * 0.5 - dy1 - arrowHead));
  1841. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5 + dy2));
  1842. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h * 0.5 + dy2));
  1843. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + x2) * 0.5, h * 0.5 + dy1));
  1844. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h * 0.5 + dy1 + arrowHead));
  1845. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1846. return (constr);
  1847. };
  1848. //**********************************************************************************************************************************************************
  1849. //Tailed Arrow with Notch
  1850. //**********************************************************************************************************************************************************
  1851. /**
  1852. * Extends mxShape.
  1853. */
  1854. function mxShapeArrows2TailedNotchedArrow(bounds, fill, stroke, strokewidth)
  1855. {
  1856. mxShape.call(this);
  1857. this.bounds = bounds;
  1858. this.fill = fill;
  1859. this.stroke = stroke;
  1860. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1861. this.dy = 0.5;
  1862. this.dx = 0.5;
  1863. this.notch = 0;
  1864. this.arrowHead = 0;
  1865. };
  1866. /**
  1867. * Extends mxShape.
  1868. */
  1869. mxUtils.extend(mxShapeArrows2TailedNotchedArrow, mxActor);
  1870. mxShapeArrows2TailedNotchedArrow.prototype.customProperties = [
  1871. {name: 'dx1', dispName: 'Arrowhead Length', type: 'float', mix:0, defVal:20},
  1872. {name: 'dy1', dispName: 'Arrow Width', type: 'float', min:0, defVal:10},
  1873. {name: 'dx2', dispName: 'Tail Length', type: 'float', min:0, defVal:25},
  1874. {name: 'dy2', dispName: 'Tail Width', type: 'float', min:0, defVal:30},
  1875. {name: 'notch', dispName: 'Notch', type: 'float', min:0, defVal:20},
  1876. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:20}
  1877. ];
  1878. mxShapeArrows2TailedNotchedArrow.prototype.cst = {
  1879. TAILED_NOTCHED_ARROW : 'mxgraph.arrows2.tailedNotchedArrow'
  1880. };
  1881. /**
  1882. * Function: paintVertexShape
  1883. *
  1884. * Paints the vertex shape.
  1885. */
  1886. mxShapeArrows2TailedNotchedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  1887. {
  1888. c.translate(x, y);
  1889. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1890. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1891. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1892. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1893. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1894. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1895. var x2 = 0;
  1896. if (dy2 != 0)
  1897. {
  1898. x2 = dx2 + notch * (dy2 - dy1) / dy2;
  1899. }
  1900. c.begin();
  1901. c.moveTo(0, h * 0.5 - dy2);
  1902. c.lineTo(dx2, h * 0.5 - dy2);
  1903. c.lineTo(x2, h * 0.5 - dy1);
  1904. c.lineTo(w - dx1, h * 0.5 - dy1);
  1905. c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);
  1906. c.lineTo(w, h * 0.5);
  1907. c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);
  1908. c.lineTo(w - dx1, h * 0.5 + dy1);
  1909. c.lineTo(x2, h * 0.5 + dy1);
  1910. c.lineTo(dx2, h * 0.5 + dy2);
  1911. c.lineTo(0, h * 0.5 + dy2);
  1912. c.lineTo(notch, h * 0.5);
  1913. c.close();
  1914. c.fillAndStroke();
  1915. };
  1916. mxCellRenderer.registerShape(mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW, mxShapeArrows2TailedNotchedArrow);
  1917. mxShapeArrows2TailedNotchedArrow.prototype.constraints = null;
  1918. Graph.handleFactory[mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW] = function(state)
  1919. {
  1920. var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)
  1921. {
  1922. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1923. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1924. var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1925. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);
  1926. }, function(bounds, pt)
  1927. {
  1928. 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;
  1929. 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;
  1930. })];
  1931. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  1932. {
  1933. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  1934. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  1935. }, function(bounds, pt)
  1936. {
  1937. 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;
  1938. });
  1939. handles.push(handle2);
  1940. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  1941. {
  1942. var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
  1943. var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
  1944. var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  1945. return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);
  1946. }, function(bounds, pt)
  1947. {
  1948. 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;
  1949. });
  1950. handles.push(handle3);
  1951. var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)
  1952. {
  1953. var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  1954. var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
  1955. return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);
  1956. }, function(bounds, pt)
  1957. {
  1958. 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;
  1959. 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;
  1960. });
  1961. handles.push(handle4);
  1962. return handles;
  1963. };
  1964. mxShapeArrows2TailedNotchedArrow.prototype.getConstraints = function(style, w, h)
  1965. {
  1966. var constr = [];
  1967. var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
  1968. var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
  1969. var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
  1970. var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
  1971. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  1972. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  1973. var x2 = 0;
  1974. if (dy2 != 0)
  1975. {
  1976. x2 = dx2 + notch * (dy2 - dy1) / dy2;
  1977. }
  1978. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, notch, 0));
  1979. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5 - dy2));
  1980. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h * 0.5 - dy2));
  1981. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + x2) * 0.5, h * 0.5 - dy1));
  1982. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h * 0.5 - dy1 - arrowHead));
  1983. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5 + dy2));
  1984. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h * 0.5 + dy2));
  1985. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx1 + x2) * 0.5, h * 0.5 + dy1));
  1986. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx1, h * 0.5 + dy1 + arrowHead));
  1987. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1988. return (constr);
  1989. };
  1990. //**********************************************************************************************************************************************************
  1991. //Striped Arrow
  1992. //**********************************************************************************************************************************************************
  1993. /**
  1994. * Extends mxShape.
  1995. */
  1996. function mxShapeArrows2StripedArrow(bounds, fill, stroke, strokewidth)
  1997. {
  1998. mxShape.call(this);
  1999. this.bounds = bounds;
  2000. this.fill = fill;
  2001. this.stroke = stroke;
  2002. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2003. this.dy = 0.5;
  2004. this.dx = 0.5;
  2005. this.notch = 0;
  2006. };
  2007. /**
  2008. * Extends mxShape.
  2009. */
  2010. mxUtils.extend(mxShapeArrows2StripedArrow, mxActor);
  2011. mxShapeArrows2StripedArrow.prototype.customProperties = [
  2012. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:40},
  2013. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, max:1, defVal:0.6},
  2014. {name: 'notch', dispName: 'Stripes Length', type: 'float', min:0, defVal:25}
  2015. ];
  2016. mxShapeArrows2StripedArrow.prototype.cst = {
  2017. STRIPED_ARROW : 'mxgraph.arrows2.stripedArrow'
  2018. };
  2019. /**
  2020. * Function: paintVertexShape
  2021. *
  2022. * Paints the vertex shape.
  2023. */
  2024. mxShapeArrows2StripedArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  2025. {
  2026. c.translate(x, y);
  2027. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2028. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  2029. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  2030. c.begin();
  2031. c.moveTo(notch, dy);
  2032. c.lineTo(w - dx, dy);
  2033. c.lineTo(w - dx, 0);
  2034. c.lineTo(w, h * 0.5);
  2035. c.lineTo(w - dx, h);
  2036. c.lineTo(w - dx, h - dy);
  2037. c.lineTo(notch, h - dy);
  2038. c.close();
  2039. c.moveTo(0, h - dy);
  2040. c.lineTo(notch * 0.16, h - dy);
  2041. c.lineTo(notch * 0.16, dy);
  2042. c.lineTo(0, dy);
  2043. c.close();
  2044. c.moveTo(notch * 0.32, h - dy);
  2045. c.lineTo(notch * 0.8, h - dy);
  2046. c.lineTo(notch * 0.8, dy);
  2047. c.lineTo(notch * 0.32, dy);
  2048. c.close();
  2049. c.fillAndStroke();
  2050. };
  2051. mxCellRenderer.registerShape(mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW, mxShapeArrows2StripedArrow);
  2052. mxShapeArrows2StripedArrow.prototype.constraints = null;
  2053. Graph.handleFactory[mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW] = function(state)
  2054. {
  2055. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  2056. {
  2057. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  2058. var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2059. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);
  2060. }, function(bounds, pt)
  2061. {
  2062. 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;
  2063. this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;
  2064. })];
  2065. var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
  2066. {
  2067. var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
  2068. return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);
  2069. }, function(bounds, pt)
  2070. {
  2071. 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;
  2072. });
  2073. handles.push(handle2);
  2074. return handles;
  2075. };
  2076. mxShapeArrows2StripedArrow.prototype.getConstraints = function(style, w, h)
  2077. {
  2078. var constr = [];
  2079. var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2080. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  2081. var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
  2082. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2083. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, 0));
  2084. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
  2085. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
  2086. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dy));
  2087. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
  2088. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dy));
  2089. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h));
  2090. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, dy));
  2091. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, h - dy));
  2092. return (constr);
  2093. };
  2094. //**********************************************************************************************************************************************************
  2095. //Jump-In Arrow
  2096. //**********************************************************************************************************************************************************
  2097. /**
  2098. * Extends mxShape.
  2099. */
  2100. function mxShapeArrows2JumpInArrow(bounds, fill, stroke, strokewidth)
  2101. {
  2102. mxShape.call(this);
  2103. this.bounds = bounds;
  2104. this.fill = fill;
  2105. this.stroke = stroke;
  2106. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2107. this.dy = 0.5;
  2108. this.dx = 0.5;
  2109. this.arrowHead = 40;
  2110. };
  2111. /**
  2112. * Extends mxShape.
  2113. */
  2114. mxUtils.extend(mxShapeArrows2JumpInArrow, mxActor);
  2115. mxShapeArrows2JumpInArrow.prototype.customProperties = [
  2116. {name: 'dx', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:38},
  2117. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:15},
  2118. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:55}
  2119. ];
  2120. mxShapeArrows2JumpInArrow.prototype.cst = {
  2121. JUMP_IN_ARROW : 'mxgraph.arrows2.jumpInArrow'
  2122. };
  2123. /**
  2124. * Function: paintVertexShape
  2125. *
  2126. * Paints the vertex shape.
  2127. */
  2128. mxShapeArrows2JumpInArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  2129. {
  2130. c.translate(x, y);
  2131. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2132. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  2133. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  2134. c.begin();
  2135. c.moveTo(w - dx, 0);
  2136. c.lineTo(w, arrowHead * 0.5);
  2137. c.lineTo(w - dx, arrowHead);
  2138. c.lineTo(w - dx, arrowHead / 2 + dy);
  2139. c.arcTo(w - dx, h - arrowHead / 2 - dy, 0, 0, 0, 0, h);
  2140. c.arcTo(w - dx, h - arrowHead / 2 + dy, 0, 0, 1, w - dx, arrowHead / 2 - dy);
  2141. c.close();
  2142. c.fillAndStroke();
  2143. };
  2144. mxCellRenderer.registerShape(mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW, mxShapeArrows2JumpInArrow);
  2145. mxShapeArrows2JumpInArrow.prototype.constraints = null;
  2146. Graph.handleFactory[mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW] = function(state)
  2147. {
  2148. var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
  2149. {
  2150. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2151. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  2152. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2153. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);
  2154. }, function(bounds, pt)
  2155. {
  2156. this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;
  2157. 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;
  2158. })];
  2159. var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  2160. {
  2161. var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
  2162. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2163. return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);
  2164. }, function(bounds, pt)
  2165. {
  2166. 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;
  2167. });
  2168. handles.push(handle2);
  2169. return handles;
  2170. };
  2171. mxShapeArrows2JumpInArrow.prototype.getConstraints = function(style, w, h)
  2172. {
  2173. var constr = [];
  2174. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2175. var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
  2176. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  2177. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  2178. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
  2179. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, arrowHead * 0.5));
  2180. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, arrowHead));
  2181. return (constr);
  2182. };
  2183. //**********************************************************************************************************************************************************
  2184. //U Turn Arrow
  2185. //**********************************************************************************************************************************************************
  2186. /**
  2187. * Extends mxShape.
  2188. */
  2189. function mxShapeArrows2UTurnArrow(bounds, fill, stroke, strokewidth)
  2190. {
  2191. mxShape.call(this);
  2192. this.bounds = bounds;
  2193. this.fill = fill;
  2194. this.stroke = stroke;
  2195. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2196. this.dy = 0.5;
  2197. this.dx = 0.5;
  2198. this.arrowHead = 40;
  2199. };
  2200. /**
  2201. * Extends mxShape.
  2202. */
  2203. mxUtils.extend(mxShapeArrows2UTurnArrow, mxActor);
  2204. mxShapeArrows2UTurnArrow.prototype.customProperties = [
  2205. {name: 'dx2', dispName: 'Arrowhead Length', type: 'float', min:0, defVal:25},
  2206. {name: 'dy', dispName: 'Arrow Width', type: 'float', min:0, defVal:11},
  2207. {name: 'arrowHead', dispName: 'Arrowhead Width', type: 'float', min:0, defVal:43}
  2208. ];
  2209. mxShapeArrows2UTurnArrow.prototype.cst = {
  2210. U_TURN_ARROW : 'mxgraph.arrows2.uTurnArrow'
  2211. };
  2212. /**
  2213. * Function: paintVertexShape
  2214. *
  2215. * Paints the vertex shape.
  2216. */
  2217. mxShapeArrows2UTurnArrow.prototype.paintVertexShape = function(c, x, y, w, h)
  2218. {
  2219. c.translate(x, y);
  2220. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2221. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  2222. var dx = (h - arrowHead / 2 + dy) / 2;
  2223. var dx2 = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2)));
  2224. c.begin();
  2225. c.moveTo(dx, 0);
  2226. c.lineTo(dx + dx2, arrowHead * 0.5);
  2227. c.lineTo(dx, arrowHead);
  2228. c.lineTo(dx, arrowHead / 2 + dy);
  2229. c.arcTo(dx - 2 * dy, dx - 2 * dy, 0, 0, 0, dx, h - 2 * dy);
  2230. c.lineTo(Math.max(w, dx), h - 2 * dy);
  2231. c.lineTo(Math.max(w, dx), h);
  2232. c.lineTo(dx, h);
  2233. c.arcTo(dx, dx, 0, 0, 1, dx, arrowHead / 2 - dy);
  2234. c.close();
  2235. c.fillAndStroke();
  2236. };
  2237. mxCellRenderer.registerShape(mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW, mxShapeArrows2UTurnArrow);
  2238. mxShapeArrows2UTurnArrow.prototype.constraints = null;
  2239. Graph.handleFactory[mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW] = function(state)
  2240. {
  2241. var handles = [Graph.createHandle(state, ['dy'], function(bounds)
  2242. {
  2243. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2244. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2245. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  2246. return new mxPoint(bounds.x + dx, bounds.y + arrowHead / 2 - dy);
  2247. }, function(bounds, pt)
  2248. {
  2249. 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;
  2250. })];
  2251. var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)
  2252. {
  2253. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2254. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2255. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  2256. var dx2 = Math.max(0, Math.min(bounds.width - dx, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
  2257. return new mxPoint(bounds.x + dx + dx2, bounds.y + arrowHead / 2);
  2258. }, function(bounds, pt)
  2259. {
  2260. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2261. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2262. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  2263. this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(Math.max(bounds.width, dx), pt.x - bounds.x - dx))) / 100;
  2264. });
  2265. handles.push(handle2);
  2266. var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)
  2267. {
  2268. var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));
  2269. var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
  2270. var dx = (bounds.height - arrowHead / 2 + dy) / 2;
  2271. return new mxPoint(bounds.x + dx, bounds.y + arrowHead);
  2272. }, function(bounds, pt)
  2273. {
  2274. 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;
  2275. });
  2276. handles.push(handle3);
  2277. return handles;
  2278. };
  2279. mxShapeArrows2UTurnArrow.prototype.getConstraints = function(style, w, h)
  2280. {
  2281. var constr = [];
  2282. var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
  2283. var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));
  2284. var dx = (h - arrowHead / 2 + dy) / 2;
  2285. var dx2 = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2)));
  2286. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));
  2287. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + dx2, arrowHead * 0.5));
  2288. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, arrowHead));
  2289. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dx + w) * 0.5, h - 2 * dy));
  2290. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.max(w, dx), h - 2 * dy));
  2291. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.max(w, dx), h - dy));
  2292. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.max(w, dx), h));
  2293. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (dx + w) * 0.5, h));
  2294. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
  2295. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h + arrowHead * 0.5 - dy) * 0.5));
  2296. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, arrowHead - 2 * dy, (h + arrowHead * 0.5 - dy) * 0.5));
  2297. return (constr);
  2298. };
  2299. //**********************************************************************************************************************************************************
  2300. //Wedge Arrow
  2301. //**********************************************************************************************************************************************************
  2302. function mxShapeArrowsWedgeArrow()
  2303. {
  2304. mxArrow.call(this);
  2305. };
  2306. mxUtils.extend(mxShapeArrowsWedgeArrow, mxArrow);
  2307. mxShapeArrowsWedgeArrow.prototype.useSvgBoundingBox = true;
  2308. mxShapeArrowsWedgeArrow.prototype.customProperties = [
  2309. {name: 'startWidth', dispName: 'Wedge Width', type: 'float', min:0, defVal:25}
  2310. ];
  2311. mxShapeArrowsWedgeArrow.prototype.paintEdgeShape = function(c, pts)
  2312. {
  2313. var sw = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'startWidth', 20)));
  2314. // Base vector (between end points)
  2315. var p0 = pts[0];
  2316. var pe = pts[pts.length - 1];
  2317. var dx = pe.x - p0.x;
  2318. var dy = pe.y - p0.y;
  2319. var dist = Math.sqrt(dx * dx + dy * dy);
  2320. var nx = dx * sw / dist;
  2321. var ny = dy * sw / dist;
  2322. c.begin();
  2323. c.moveTo(p0.x + ny, p0.y - nx);
  2324. c.lineTo(p0.x - ny, p0.y + nx);
  2325. c.lineTo(pe.x, pe.y);
  2326. c.close();
  2327. c.fillAndStroke();
  2328. };
  2329. mxCellRenderer.registerShape('mxgraph.arrows2.wedgeArrow', mxShapeArrowsWedgeArrow);
  2330. //**********************************************************************************************************************************************************
  2331. //Wedge Arrow Dashed
  2332. //**********************************************************************************************************************************************************
  2333. function mxShapeArrowsWedgeArrowDashed()
  2334. {
  2335. mxArrowConnector.call(this);
  2336. };
  2337. mxUtils.extend(mxShapeArrowsWedgeArrowDashed, mxArrow);
  2338. mxShapeArrowsWedgeArrowDashed.prototype.useSvgBoundingBox = true;
  2339. mxShapeArrowsWedgeArrowDashed.prototype.customProperties = [
  2340. {name: 'startWidth', dispName: 'Wedge Width', type: 'float', min:0, defVal:25}
  2341. ];
  2342. mxShapeArrowsWedgeArrowDashed.prototype.paintEdgeShape = function(c, pts)
  2343. {
  2344. var startWidth = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'startWidth', 20)));
  2345. var steps = 8;
  2346. // Base vector (between end points)
  2347. var p0 = pts[0];
  2348. var pe = pts[pts.length - 1];
  2349. var dx = pe.x - p0.x;
  2350. var dy = pe.y - p0.y;
  2351. var dist = Math.sqrt(dx * dx + dy * dy);
  2352. var nx = dx * startWidth / dist;
  2353. var ny = dy * startWidth / dist;
  2354. var cnx = nx; // current nx
  2355. var cny = ny; // current ny
  2356. var pcx = p0.x; // current x on edge
  2357. var pcy = p0.y; // current y on edge
  2358. c.begin();
  2359. for (var i = 0; i <= steps; i++)
  2360. {
  2361. cnx = nx * (steps - i) / steps;
  2362. cny = ny * (steps - i) / steps;
  2363. if (i == steps)
  2364. {
  2365. cnx = nx * (steps - i * 0.98) / steps;
  2366. cny = ny * (steps - i * 0.98) / steps;
  2367. }
  2368. var px1 = pcx + cny;
  2369. var py1 = pcy - cnx;
  2370. var px2 = pcx - cny;
  2371. var py2 = pcy + cnx;
  2372. c.moveTo(px1, py1);
  2373. c.lineTo(px2, py2);
  2374. pcx = pcx + dx / steps;
  2375. pcy = pcy + dy / steps;
  2376. }
  2377. c.stroke();
  2378. };
  2379. mxCellRenderer.registerShape('mxgraph.arrows2.wedgeArrowDashed', mxShapeArrowsWedgeArrowDashed);
  2380. //**********************************************************************************************************************************************************
  2381. //Wedge Arrow Dashed v2
  2382. //**********************************************************************************************************************************************************
  2383. function mxShapeArrowsWedgeArrowDashed2()
  2384. {
  2385. mxArrowConnector.call(this);
  2386. };
  2387. mxUtils.extend(mxShapeArrowsWedgeArrowDashed2, mxArrow);
  2388. mxShapeArrowsWedgeArrowDashed2.prototype.useSvgBoundingBox = true;
  2389. mxShapeArrowsWedgeArrowDashed2.prototype.customProperties = [
  2390. {name: 'startWidth', dispName: 'Wedge Width', type: 'float', min:0, defVal:25},
  2391. {name: 'stepSize', dispName: 'Step Size', type: 'float', min:0, defVal:25}
  2392. ];
  2393. mxShapeArrowsWedgeArrowDashed2.prototype.paintEdgeShape = function(c, pts)
  2394. {
  2395. var startWidth = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'startWidth', 20)));
  2396. var stepSize = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'stepSize', 10)));
  2397. // Base vector (between end points)
  2398. var p0 = pts[0];
  2399. var pe = pts[pts.length - 1];
  2400. var dx = pe.x - p0.x;
  2401. var dy = pe.y - p0.y;
  2402. var dist = Math.sqrt(dx * dx + dy * dy);
  2403. var nx = dx * startWidth / dist;
  2404. var ny = dy * startWidth / dist;
  2405. var cnx = nx; // current nx
  2406. var cny = ny; // current ny
  2407. var pcx = p0.x; // current x on edge
  2408. var pcy = p0.y; // current y on edge
  2409. var steps = (stepSize > 0) ? Math.floor(dist / stepSize) : 0;
  2410. c.begin();
  2411. for (var i = 0; i <= steps; i++)
  2412. {
  2413. cnx = nx * (steps - i) / steps;
  2414. cny = ny * (steps - i) / steps;
  2415. if (i == steps)
  2416. {
  2417. cnx = nx * (steps - i * 0.98) / steps;
  2418. cny = ny * (steps - i * 0.98) / steps;
  2419. }
  2420. var px1 = pcx + cny;
  2421. var py1 = pcy - cnx;
  2422. var px2 = pcx - cny;
  2423. var py2 = pcy + cnx;
  2424. c.moveTo(px1, py1);
  2425. c.lineTo(px2, py2);
  2426. pcx = pcx + dx / steps;
  2427. pcy = pcy + dy / steps;
  2428. }
  2429. c.stroke();
  2430. };
  2431. mxCellRenderer.registerShape('mxgraph.arrows2.wedgeArrowDashed2', mxShapeArrowsWedgeArrowDashed2);