mxArrows.js 127 KB

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