Best JavaScript code snippet using puppeteer
mxArrows.js
Source:mxArrows.js
...52mxCellRenderer.registerShape(mxShapeArrows2Arrow.prototype.cst.ARROW, mxShapeArrows2Arrow);53mxShapeArrows2Arrow.prototype.constraints = null;54Graph.handleFactory[mxShapeArrows2Arrow.prototype.cst.ARROW] = function(state)55{56 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)57 {58 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));59 var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));60 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);61 }, function(bounds, pt)62 {63 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width - parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch)), bounds.x + bounds.width - pt.x))) / 100;64 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;65 })];66 67 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)68 {69 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));70 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);71 }, function(bounds, pt)72 {73 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;74 });75 76 handles.push(handle2);77 78 return handles;79}80//**********************************************************************************************************************************************************81//Two Way Arrow82//**********************************************************************************************************************************************************83/**84* Extends mxShape.85*/86function mxShapeArrows2TwoWayArrow(bounds, fill, stroke, strokewidth)87{88 mxShape.call(this);89 this.bounds = bounds;90 this.fill = fill;91 this.stroke = stroke;92 this.strokewidth = (strokewidth != null) ? strokewidth : 1;93 this.dy = 0.5;94 this.dx = 0.5;95};96/**97* Extends mxShape.98*/99mxUtils.extend(mxShapeArrows2TwoWayArrow, mxActor);100mxShapeArrows2TwoWayArrow.prototype.cst = {101 TWO_WAY_ARROW : 'mxgraph.arrows2.twoWayArrow'102};103/**104* Function: paintVertexShape105* 106* Paints the vertex shape.107*/108mxShapeArrows2TwoWayArrow.prototype.paintVertexShape = function(c, x, y, w, h)109{110 c.translate(x, y);111 var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));112 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));113 c.begin();114 c.moveTo(dx, dy);115 c.lineTo(w - dx, dy);116 c.lineTo(w - dx, 0);117 c.lineTo(w, h * 0.5);118 c.lineTo(w - dx, h);119 c.lineTo(w - dx, h - dy);120 c.lineTo(dx, h - dy);121 c.lineTo(dx, h);122 c.lineTo(0, h * 0.5);123 c.lineTo(dx, 0);124 c.close();125 c.fillAndStroke();126};127mxCellRenderer.registerShape(mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_ARROW, mxShapeArrows2TwoWayArrow);128mxShapeArrows2TwoWayArrow.prototype.constraints = null;129Graph.handleFactory[mxShapeArrows2TwoWayArrow.prototype.cst.TWO_WAY_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 / 2, 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 / 2, 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 142 return handles;143}144//**********************************************************************************************************************************************************145//Stylised Arrow146//**********************************************************************************************************************************************************147/**148* Extends mxShape.149*/150function mxShapeArrows2StylisedArrow(bounds, fill, stroke, strokewidth)151{152 mxShape.call(this);153 this.bounds = bounds;154 this.fill = fill;155 this.stroke = stroke;156 this.strokewidth = (strokewidth != null) ? strokewidth : 1;157 this.dy = 0.5;158 this.dx = 0.5;159 this.notch = 0;160 this.feather = 0.5;161};162/**163* Extends mxShape.164*/165mxUtils.extend(mxShapeArrows2StylisedArrow, mxActor);166mxShapeArrows2StylisedArrow.prototype.cst = {167 STYLISED_ARROW : 'mxgraph.arrows2.stylisedArrow'168};169/**170* Function: paintVertexShape171* 172* Paints the vertex shape.173*/174mxShapeArrows2StylisedArrow.prototype.paintVertexShape = function(c, x, y, w, h)175{176 c.translate(x, y);177 var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));178 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));179 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));180 var feather = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'feather', this.feather))));181 c.begin();182 c.moveTo(0, feather);183 c.lineTo(w - dx, dy);184 c.lineTo(w - dx - 10, 0);185 c.lineTo(w, h * 0.5);186 c.lineTo(w - dx - 10, h);187 c.lineTo(w - dx, h - dy);188 c.lineTo(0, h - feather);189 c.lineTo(notch, h * 0.5);190 c.close();191 c.fillAndStroke();192};193mxCellRenderer.registerShape(mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW, mxShapeArrows2StylisedArrow);194mxShapeArrows2StylisedArrow.prototype.constraints = null;195Graph.handleFactory[mxShapeArrows2StylisedArrow.prototype.cst.STYLISED_ARROW] = function(state)196{197 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)198 {199 var dx = Math.max(0, Math.min(bounds.width - 10, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));200 var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));201 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);202 }, function(bounds, pt)203 {204 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;205 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;206 })];207 208 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)209 {210 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))));211 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);212 }, function(bounds, pt)213 {214 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;215 });216 217 handles.push(handle2);218 219 var handle3 = Graph.createHandle(state, ['feather'], function(bounds)220 {221 var feather = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'feather', this.dy))));222 return new mxPoint(bounds.x, bounds.y + feather * bounds.height / 2);223 }, function(bounds, pt)224 {225 this.state.style['feather'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;226 });227 228 handles.push(handle3);229 230 return handles;231}232//**********************************************************************************************************************************************************233//Sharp Arrow234//**********************************************************************************************************************************************************235/**236* Extends mxShape.237*/238function mxShapeArrows2SharpArrow(bounds, fill, stroke, strokewidth)239{240 mxShape.call(this);241 this.bounds = bounds;242 this.fill = fill;243 this.stroke = stroke;244 this.strokewidth = (strokewidth != null) ? strokewidth : 1;245 this.dy1 = 0.5;246 this.dx1 = 0.5;247 this.dx2 = 0.5;248 this.notch = 0;249};250/**251* Extends mxShape.252*/253mxUtils.extend(mxShapeArrows2SharpArrow, mxActor);254mxShapeArrows2SharpArrow.prototype.cst = {255 SHARP_ARROW : 'mxgraph.arrows2.sharpArrow'256};257/**258* Function: paintVertexShape259* 260* Paints the vertex shape.261*/262mxShapeArrows2SharpArrow.prototype.paintVertexShape = function(c, x, y, w, h)263{264 c.translate(x, y);265 var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));266 var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));267 var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));268 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));269 var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));270 var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));271 var x2 = 0;272 273 if (h != 0)274 {275 x2 = dx1a + dx2 * dy1a * 2 / h;276 }277 278 c.begin();279 c.moveTo(0, dy1);280 c.lineTo(w - dx1, dy1);281 c.lineTo(w - x2, 0);282 c.lineTo(w - dx2, 0);283 c.lineTo(w, h * 0.5);284 c.lineTo(w - dx2, h);285 c.lineTo(w - x2, h);286 c.lineTo(w - dx1, h - dy1);287 c.lineTo(0, h - dy1);288 c.lineTo(notch, h * 0.5);289 c.close();290 c.fillAndStroke();291};292mxCellRenderer.registerShape(mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW, mxShapeArrows2SharpArrow);293mxShapeArrows2SharpArrow.prototype.constraints = null;294Graph.handleFactory[mxShapeArrows2SharpArrow.prototype.cst.SHARP_ARROW] = function(state)295{296 var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)297 {298 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));299 var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));300 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);301 }, function(bounds, pt)302 {303 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;304 this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;305 })];306 307 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)308 {309 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));310 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);311 }, function(bounds, pt)312 {313 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;314 });315 316 handles.push(handle2);317 318 var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)319 {320 var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));321 return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);322 }, function(bounds, pt)323 {324 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;325 });326 327 handles.push(handle3);328 329 return handles;330}331//**********************************************************************************************************************************************************332//Sharp Arrow2333//**********************************************************************************************************************************************************334/**335* Extends mxShape.336*/337function mxShapeArrows2SharpArrow2(bounds, fill, stroke, strokewidth)338{339 mxShape.call(this);340 this.bounds = bounds;341 this.fill = fill;342 this.stroke = stroke;343 this.strokewidth = (strokewidth != null) ? strokewidth : 1;344 this.dy1 = 0.5;345 this.dx1 = 0.5;346 this.dx2 = 0.5;347 this.dy3 = 0.5;348 this.dx3 = 0.5;349 this.notch = 0;350};351/**352* Extends mxShape.353*/354mxUtils.extend(mxShapeArrows2SharpArrow2, mxActor);355mxShapeArrows2SharpArrow2.prototype.cst = {356 SHARP_ARROW2 : 'mxgraph.arrows2.sharpArrow2'357};358/**359* Function: paintVertexShape360* 361* Paints the vertex shape.362*/363mxShapeArrows2SharpArrow2.prototype.paintVertexShape = function(c, x, y, w, h)364{365 c.translate(x, y);366 var dy1 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));367 var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));368 var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));369 370 var dy3 = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy3', this.dy3))));371 var dx3 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx3', this.dx3))));372 373 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));374 var dx1a = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));375 var dy1a = h * 0.5 * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));376 c.begin();377 c.moveTo(0, dy1);378 c.lineTo(w - dx1, dy1);379 c.lineTo(w - dx3, dy3);380 c.lineTo(w - dx2, 0);381 c.lineTo(w, h * 0.5);382 c.lineTo(w - dx2, h);383 c.lineTo(w - dx3, h - dy3);384 c.lineTo(w - dx1, h - dy1);385 c.lineTo(0, h - dy1);386 c.lineTo(notch, h * 0.5);387 c.close();388 c.fillAndStroke();389};390mxCellRenderer.registerShape(mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2, mxShapeArrows2SharpArrow2);391mxShapeArrows2SharpArrow2.prototype.constraints = null;392Graph.handleFactory[mxShapeArrows2SharpArrow2.prototype.cst.SHARP_ARROW2] = function(state)393{394 var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)395 {396 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));397 var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));398 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + dy1 * bounds.height / 2);399 }, function(bounds, pt)400 {401 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;402 this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;403 })];404 405 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)406 {407 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));408 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);409 }, function(bounds, pt)410 {411 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;412 });413 414 handles.push(handle2);415 416 var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)417 {418 var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));419 return new mxPoint(bounds.x + bounds.width - dx2, bounds.y);420 }, function(bounds, pt)421 {422 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;423 });424 425 handles.push(handle3);426 var handle4 = Graph.createHandle(state, ['dx3', 'dy3'], function(bounds)427 {428 var dx3 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx3', this.dx3))));429 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))));430 return new mxPoint(bounds.x + bounds.width - dx3, bounds.y + dy3 * bounds.height / 2);431 }, function(bounds, pt)432 {433 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;434 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;435 });436 handles.push(handle4);437 return handles;438}439//**********************************************************************************************************************************************************440//Callout Arrow441//**********************************************************************************************************************************************************442/**443* Extends mxShape.444*/445function mxShapeArrows2CalloutArrow(bounds, fill, stroke, strokewidth)446{447 mxShape.call(this);448 this.bounds = bounds;449 this.fill = fill;450 this.stroke = stroke;451 this.strokewidth = (strokewidth != null) ? strokewidth : 1;452 this.dy = 0.5;453 this.dx = 0.5;454 this.notch = 0;455 this.arrowHead = 0;456};457/**458* Extends mxShape.459*/460mxUtils.extend(mxShapeArrows2CalloutArrow, mxActor);461mxShapeArrows2CalloutArrow.prototype.cst = {462 CALLOUT_ARROW : 'mxgraph.arrows2.calloutArrow'463};464/**465* Function: paintVertexShape466* 467* Paints the vertex shape.468*/469mxShapeArrows2CalloutArrow.prototype.paintVertexShape = function(c, x, y, w, h)470{471 c.translate(x, y);472 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));473 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));474 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));475 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));476 c.begin();477 c.moveTo(0, 0);478 c.lineTo(notch, 0);479 c.lineTo(notch, h * 0.5 - dy);480 c.lineTo(w - dx, h * 0.5 - dy);481 c.lineTo(w - dx, h * 0.5 - dy - arrowHead);482 c.lineTo(w, h * 0.5);483 c.lineTo(w - dx, h * 0.5 + dy + arrowHead);484 c.lineTo(w - dx, h * 0.5 + dy);485 c.lineTo(notch, h * 0.5 + dy);486 c.lineTo(notch, h);487 c.lineTo(0, h);488 c.close();489 c.fillAndStroke();490};491mxCellRenderer.registerShape(mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW, mxShapeArrows2CalloutArrow);492mxShapeArrows2CalloutArrow.prototype.constraints = null;493Graph.handleFactory[mxShapeArrows2CalloutArrow.prototype.cst.CALLOUT_ARROW] = function(state)494{495 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)496 {497 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));498 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));499 var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));500 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);501 }, function(bounds, pt)502 {503 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;504 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;505 506 })];507 508 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)509 {510 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));511 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);512 }, function(bounds, pt)513 {514 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;515 });516 handles.push(handle2);517 518 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)519 {520 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));521 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));522 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));523 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);524 }, function(bounds, pt)525 {526 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;527 });528 handles.push(handle3);529 530 return handles;531}532//**********************************************************************************************************************************************************533//Bend Arrow534//**********************************************************************************************************************************************************535/**536* Extends mxShape.537*/538function mxShapeArrows2BendArrow(bounds, fill, stroke, strokewidth)539{540 mxShape.call(this);541 this.bounds = bounds;542 this.fill = fill;543 this.stroke = stroke;544 this.strokewidth = (strokewidth != null) ? strokewidth : 1;545 this.dy = 0.5;546 this.dx = 0.5;547 this.notch = 0;548 this.arrowHead = 40;549};550/**551* Extends mxShape.552*/553mxUtils.extend(mxShapeArrows2BendArrow, mxActor);554mxShapeArrows2BendArrow.prototype.cst = {555 BEND_ARROW : 'mxgraph.arrows2.bendArrow'556};557/**558* Function: paintVertexShape559* 560* Paints the vertex shape.561*/562mxShapeArrows2BendArrow.prototype.paintVertexShape = function(c, x, y, w, h)563{564 c.translate(x, y);565 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));566 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));567 var notch = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));568 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));569 var rounded = mxUtils.getValue(this.style, 'rounded', '0');570 c.begin();571 c.moveTo(w - dx, 0);572 c.lineTo(w, arrowHead * 0.5);573 c.lineTo(w - dx, arrowHead);574 c.lineTo(w - dx, arrowHead / 2 + dy);575 if (rounded == '1')576 {577 c.lineTo(dy * 2.2, arrowHead / 2 + dy);578 c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, dy * 2, arrowHead / 2 + dy * 1.2);579 }580 else581 {582 c.lineTo(dy * 2, arrowHead / 2 + dy);583 }584 585 c.lineTo(dy * 2, h);586 c.lineTo(dy, h - notch);587 c.lineTo(0, h);588 589 if (rounded == '1')590 {591 c.lineTo(0, arrowHead / 2 + dy);592 c.arcTo(dy * 2, dy * 2, 0, 0, 1, dy * 2, arrowHead / 2 - dy);593 }594 else595 {596 c.lineTo(0, arrowHead / 2 - dy);597 }598 c.lineTo(w - dx, arrowHead / 2 - dy);599 c.close();600 c.fillAndStroke();601};602mxCellRenderer.registerShape(mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW, mxShapeArrows2BendArrow);603mxShapeArrows2BendArrow.prototype.constraints = null;604Graph.handleFactory[mxShapeArrows2BendArrow.prototype.cst.BEND_ARROW] = function(state)605{606 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)607 {608 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));609 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));610 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));611 612 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);613 }, function(bounds, pt)614 {615 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;616 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;617 618 })];619 620 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)621 {622 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));623 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));624 625 var notch = Math.max(0, Math.min(bounds.height - arrowHead / 2 - dy, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));626 return new mxPoint(bounds.x + dy, bounds.y + bounds.height - notch);627 }, function(bounds, pt)628 {629 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;630 });631 632 handles.push(handle2);633 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)634 {635 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));636 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));637 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);638 }, function(bounds, pt)639 {640 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;641 });642 643 handles.push(handle3);644 return handles;645}646//**********************************************************************************************************************************************************647//Bend Double Arrow648//**********************************************************************************************************************************************************649/**650* Extends mxShape.651*/652function mxShapeArrows2BendDoubleArrow(bounds, fill, stroke, strokewidth)653{654 mxShape.call(this);655 this.bounds = bounds;656 this.fill = fill;657 this.stroke = stroke;658 this.strokewidth = (strokewidth != null) ? strokewidth : 1;659 this.dy = 0.5;660 this.dx = 0.5;661 this.notch = 0;662 this.arrowHead = 40;663};664/**665* Extends mxShape.666*/667mxUtils.extend(mxShapeArrows2BendDoubleArrow, mxActor);668mxShapeArrows2BendDoubleArrow.prototype.cst = {669 BEND_DOUBLE_ARROW : 'mxgraph.arrows2.bendDoubleArrow'670};671/**672* Function: paintVertexShape673* 674* Paints the vertex shape.675*/676mxShapeArrows2BendDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)677{678 c.translate(x, y);679 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));680 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));681 var arrowHead = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));682 var rounded = mxUtils.getValue(this.style, 'rounded', '0');683 c.begin();684 c.moveTo(w - dx, 0);685 c.lineTo(w, arrowHead * 0.5);686 c.lineTo(w - dx, arrowHead);687 c.lineTo(w - dx, arrowHead / 2 + dy);688 if (rounded == '1')689 {690 c.lineTo(arrowHead / 2 + dy * 1.2, arrowHead / 2 + dy);691 c.arcTo(dy * 0.2, dy * 0.2, 0, 0, 0, arrowHead /2 + dy, arrowHead / 2 + dy * 1.2);692 }693 else694 {695 c.lineTo(arrowHead / 2 + dy, arrowHead / 2 + dy);696 }697 698 c.lineTo(arrowHead / 2 + dy, h - dx);699 c.lineTo(arrowHead, h - dx);700 c.lineTo(arrowHead / 2, h);701 c.lineTo(0, h - dx);702 c.lineTo(arrowHead / 2 - dy, h - dx);703 704 if (rounded == '1')705 {706 c.lineTo(arrowHead / 2 - dy, arrowHead / 2 + dy);707 c.arcTo(dy * 2, dy * 2, 0, 0, 1, arrowHead / 2 + dy, arrowHead / 2 - dy);708 }709 else710 {711 c.lineTo(arrowHead / 2 - dy, arrowHead / 2 - dy);712 }713 c.lineTo(w - dx, arrowHead / 2 - dy);714 c.close();715 c.fillAndStroke();716};717mxCellRenderer.registerShape(mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW, mxShapeArrows2BendDoubleArrow);718mxShapeArrows2BendDoubleArrow.prototype.constraints = null;719Graph.handleFactory[mxShapeArrows2BendDoubleArrow.prototype.cst.BEND_DOUBLE_ARROW] = function(state)720{721 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)722 {723 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))));724 var dx = Math.max(0, Math.min(Math.min(bounds.width, bounds.height) - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));725 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));726 727 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);728 }, function(bounds, pt)729 {730 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;731 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;732 733 })];734 735 var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)736 {737 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));738 var arrowHead = Math.max(0, Math.min(Math.min(bounds.height, bounds.width) - dx, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));739 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);740 }, function(bounds, pt)741 {742 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;743 });744 745 handles.push(handle2);746 return handles;747}748//**********************************************************************************************************************************************************749//Callout Double Arrow750//**********************************************************************************************************************************************************751/**752* Extends mxShape.753*/754function mxShapeArrows2CalloutDoubleArrow(bounds, fill, stroke, strokewidth)755{756 mxShape.call(this);757 this.bounds = bounds;758 this.fill = fill;759 this.stroke = stroke;760 this.strokewidth = (strokewidth != null) ? strokewidth : 1;761 this.dy = 0.5;762 this.dx = 0.5;763 this.notch = 0;764 this.arrowHead = 0;765};766/**767* Extends mxShape.768*/769mxUtils.extend(mxShapeArrows2CalloutDoubleArrow, mxActor);770mxShapeArrows2CalloutDoubleArrow.prototype.cst = {771 CALLOUT_DOUBLE_ARROW : 'mxgraph.arrows2.calloutDoubleArrow'772};773/**774* Function: paintVertexShape775* 776* Paints the vertex shape.777*/778mxShapeArrows2CalloutDoubleArrow.prototype.paintVertexShape = function(c, x, y, w, h)779{780 c.translate(x, y);781 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));782 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));783 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));784 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));785 c.begin();786 c.moveTo(w / 2 - notch, 0);787 c.lineTo(w / 2 + notch, 0);788 c.lineTo(w / 2 + notch, h * 0.5 - dy);789 c.lineTo(w - dx, h * 0.5 - dy);790 c.lineTo(w - dx, h * 0.5 - dy - arrowHead);791 c.lineTo(w, h * 0.5);792 c.lineTo(w - dx, h * 0.5 + dy + arrowHead);793 c.lineTo(w - dx, h * 0.5 + dy);794 c.lineTo(w / 2 + notch, h * 0.5 + dy);795 c.lineTo(w / 2 + notch, h);796 c.lineTo(w / 2 - notch, h);797 c.lineTo(w / 2 - notch, h * 0.5 + dy);798 c.lineTo(dx, h * 0.5 + dy);799 c.lineTo(dx, h * 0.5 + dy + arrowHead);800 c.lineTo(0, h * 0.5);801 c.lineTo(dx, h * 0.5 - dy - arrowHead);802 c.lineTo(dx, h * 0.5 - dy);803 c.lineTo(w / 2 - notch, h * 0.5 - dy);804 c.close();805 c.fillAndStroke();806};807mxCellRenderer.registerShape(mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW, mxShapeArrows2CalloutDoubleArrow);808mxShapeArrows2CalloutDoubleArrow.prototype.constraints = null;809Graph.handleFactory[mxShapeArrows2CalloutDoubleArrow.prototype.cst.CALLOUT_DOUBLE_ARROW] = function(state)810{811 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)812 {813 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));814 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));815 var dy = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));816 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);817 }, function(bounds, pt)818 {819 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;820 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;821 822 })];823 824 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)825 {826 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));827 return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);828 }, function(bounds, pt)829 {830 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;831 });832 handles.push(handle2);833 834 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)835 {836 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));837 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));838 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));839 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);840 }, function(bounds, pt)841 {842 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;843 });844 handles.push(handle3);845 846 return handles;847}848//**********************************************************************************************************************************************************849//Callout Quad Arrow850//**********************************************************************************************************************************************************851/**852* Extends mxShape.853*/854function mxShapeArrows2CalloutQuadArrow(bounds, fill, stroke, strokewidth)855{856 mxShape.call(this);857 this.bounds = bounds;858 this.fill = fill;859 this.stroke = stroke;860 this.strokewidth = (strokewidth != null) ? strokewidth : 1;861 this.dy = 0.5;862 this.dx = 0.5;863 this.notch = 0;864 this.arrowHead = 0;865};866/**867* Extends mxShape.868*/869mxUtils.extend(mxShapeArrows2CalloutQuadArrow, mxActor);870mxShapeArrows2CalloutQuadArrow.prototype.cst = {871 CALLOUT_QUAD_ARROW : 'mxgraph.arrows2.calloutQuadArrow'872};873/**874* Function: paintVertexShape875* 876* Paints the vertex shape.877*/878mxShapeArrows2CalloutQuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)879{880 c.translate(x, y);881 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));882 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));883 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));884 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));885 c.begin();886 c.moveTo(w * 0.5 + dy, h * 0.5 - notch);887 c.lineTo(w * 0.5 + notch, h * 0.5 - notch);888 c.lineTo(w * 0.5 + notch, h * 0.5 - dy);889 c.lineTo(w - dx, h * 0.5 - dy);890 c.lineTo(w - dx, h * 0.5 - dy - arrowHead);891 c.lineTo(w, h * 0.5);892 c.lineTo(w - dx, h * 0.5 + dy + arrowHead);893 c.lineTo(w - dx, h * 0.5 + dy);894 c.lineTo(w * 0.5 + notch, h * 0.5 + dy);895 c.lineTo(w * 0.5 + notch, h * 0.5 + notch);896 c.lineTo(w * 0.5 + dy, h * 0.5 + notch);897 c.lineTo(w * 0.5 + dy, h - dx);898 c.lineTo(w * 0.5 + dy + arrowHead, h - dx);899 c.lineTo(w * 0.5, h);900 c.lineTo(w * 0.5 - dy - arrowHead, h - dx);901 c.lineTo(w * 0.5 - dy, h - dx);902 c.lineTo(w * 0.5 - dy, h * 0.5 + notch);903 c.lineTo(w * 0.5 - notch, h * 0.5 + notch);904 c.lineTo(w * 0.5 - notch, h * 0.5 + dy);905 c.lineTo(dx, h * 0.5 + dy);906 c.lineTo(dx, h * 0.5 + dy + arrowHead);907 c.lineTo(0, h * 0.5);908 c.lineTo(dx, h * 0.5 - dy - arrowHead);909 c.lineTo(dx, h * 0.5 - dy);910 c.lineTo(w * 0.5 - notch, h * 0.5 - dy);911 c.lineTo(w * 0.5 - notch, h * 0.5 - notch);912 c.lineTo(w * 0.5 - dy, h * 0.5 - notch);913 c.lineTo(w * 0.5 - dy, dx);914 c.lineTo(w * 0.5 - dy - arrowHead, dx);915 c.lineTo(w * 0.5, 0);916 c.lineTo(w * 0.5 + dy + arrowHead, dx);917 c.lineTo(w * 0.5 + dy, dx);918 c.close();919 c.fillAndStroke();920};921mxCellRenderer.registerShape(mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW, mxShapeArrows2CalloutQuadArrow);922mxShapeArrows2CalloutQuadArrow.prototype.constraints = null;923Graph.handleFactory[mxShapeArrows2CalloutQuadArrow.prototype.cst.CALLOUT_QUAD_ARROW] = function(state)924{925 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)926 {927 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));928 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));929 var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));930 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);931 }, function(bounds, pt)932 {933 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;934 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;935 936 })];937 938 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)939 {940 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))));941 return new mxPoint(bounds.x + bounds.width / 2 + notch, bounds.y + bounds.height / 2);942 }, function(bounds, pt)943 {944 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;945 });946 handles.push(handle2);947 948 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)949 {950 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));951 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));952 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));953 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);954 }, function(bounds, pt)955 {956 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;957 });958 handles.push(handle3);959 960 return handles;961}962//**********************************************************************************************************************************************************963//Callout Double 90 Arrow964//**********************************************************************************************************************************************************965/**966* Extends mxShape.967*/968function mxShapeArrows2CalloutDouble90Arrow(bounds, fill, stroke, strokewidth)969{970 mxShape.call(this);971 this.bounds = bounds;972 this.fill = fill;973 this.stroke = stroke;974 this.strokewidth = (strokewidth != null) ? strokewidth : 1;975 this.dy1 = 0.5;976 this.dx1 = 0.5;977 this.dx2 = 0;978 this.dy2 = 0;979 this.arrowHead = 0;980};981/**982* Extends mxShape.983*/984mxUtils.extend(mxShapeArrows2CalloutDouble90Arrow, mxActor);985mxShapeArrows2CalloutDouble90Arrow.prototype.cst = {986 CALLOUT_DOUBLE_90_ARROW : 'mxgraph.arrows2.calloutDouble90Arrow'987};988/**989* Function: paintVertexShape990* 991* Paints the vertex shape.992*/993mxShapeArrows2CalloutDouble90Arrow.prototype.paintVertexShape = function(c, x, y, w, h)994{995 c.translate(x, y);996 var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));997 var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));998 var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));999 var dy2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));1000 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1001 c.begin();1002 c.moveTo(0, 0);1003 c.lineTo(dx2, 0);1004 c.lineTo(dx2, dy2 * 0.5 - dy1);1005 c.lineTo(w - dx1, dy2 * 0.5 - dy1);1006 c.lineTo(w - dx1, dy2 * 0.5 - dy1 - arrowHead);1007 c.lineTo(w, dy2 * 0.5);1008 c.lineTo(w - dx1, dy2 * 0.5 + dy1 + arrowHead);1009 c.lineTo(w - dx1, dy2 * 0.5 + dy1);1010 c.lineTo(dx2, dy2 * 0.5 + dy1);1011 c.lineTo(dx2, dy2);1012 c.lineTo(dx2 / 2 + dy1, dy2);1013 c.lineTo(dx2 / 2 + dy1, h - dx1);1014 c.lineTo(dx2 / 2 + dy1 + arrowHead, h - dx1);1015 c.lineTo(dx2 / 2, h);1016 c.lineTo(dx2 / 2 - dy1 - arrowHead, h - dx1);1017 c.lineTo(dx2 / 2 - dy1, h - dx1);1018 c.lineTo(dx2 / 2 - dy1, dy2);1019 c.lineTo(0, dy2);1020 c.close();1021 c.fillAndStroke();1022};1023mxCellRenderer.registerShape(mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW, mxShapeArrows2CalloutDouble90Arrow);1024mxShapeArrows2CalloutDouble90Arrow.prototype.constraints = null;1025Graph.handleFactory[mxShapeArrows2CalloutDouble90Arrow.prototype.cst.CALLOUT_DOUBLE_90_ARROW] = function(state)1026{1027 var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)1028 {1029 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))));1030 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))));1031 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))));1032 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1);1033 }, function(bounds, pt)1034 {1035 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;1036 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;1037 1038 })];1039 1040 var handle2 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)1041 {1042 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))));1043 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))));1044 return new mxPoint(bounds.x + dx2, bounds.y + dy2);1045 }, function(bounds, pt)1046 {1047 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;1048 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;1049 });1050 handles.push(handle2);1051 1052 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)1053 {1054 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));1055 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))));1056 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))));1057 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2)) / 2 - dy1 - arrowHead);1058 }, function(bounds, pt)1059 {1060 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;1061 });1062 handles.push(handle3);1063 1064 return handles;1065}1066//**********************************************************************************************************************************************************1067//Quad Arrow1068//**********************************************************************************************************************************************************1069/**1070* Extends mxShape.1071*/1072function mxShapeArrows2QuadArrow(bounds, fill, stroke, strokewidth)1073{1074 mxShape.call(this);1075 this.bounds = bounds;1076 this.fill = fill;1077 this.stroke = stroke;1078 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1079 this.dy = 0.5;1080 this.dx = 0.5;1081 this.notch = 0;1082 this.arrowHead = 0;1083};1084/**1085* Extends mxShape.1086*/1087mxUtils.extend(mxShapeArrows2QuadArrow, mxActor);1088mxShapeArrows2QuadArrow.prototype.cst = {1089 QUAD_ARROW : 'mxgraph.arrows2.quadArrow'1090};1091/**1092* Function: paintVertexShape1093* 1094* Paints the vertex shape.1095*/1096mxShapeArrows2QuadArrow.prototype.paintVertexShape = function(c, x, y, w, h)1097{1098 c.translate(x, y);1099 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));1100 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1101 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1102 c.begin();1103 c.moveTo(w * 0.5 + dy, h * 0.5 - dy);1104 c.lineTo(w - dx, h * 0.5 - dy);1105 c.lineTo(w - dx, h * 0.5 - dy - arrowHead);1106 c.lineTo(w, h * 0.5);1107 c.lineTo(w - dx, h * 0.5 + dy + arrowHead);1108 c.lineTo(w - dx, h * 0.5 + dy);1109 c.lineTo(w * 0.5 + dy, h * 0.5 + dy);1110 c.lineTo(w * 0.5 + dy, h - dx);1111 c.lineTo(w * 0.5 + dy + arrowHead, h - dx);1112 c.lineTo(w * 0.5, h);1113 c.lineTo(w * 0.5 - dy - arrowHead, h - dx);1114 c.lineTo(w * 0.5 - dy, h - dx);1115 c.lineTo(w * 0.5 - dy, h * 0.5 + dy);1116 c.lineTo(dx, h * 0.5 + dy);1117 c.lineTo(dx, h * 0.5 + dy + arrowHead);1118 c.lineTo(0, h * 0.5);1119 c.lineTo(dx, h * 0.5 - dy - arrowHead);1120 c.lineTo(dx, h * 0.5 - dy);1121 c.lineTo(w * 0.5 - dy, h * 0.5 - dy);1122 c.lineTo(w * 0.5 - dy, dx);1123 c.lineTo(w * 0.5 - dy - arrowHead, dx);1124 c.lineTo(w * 0.5, 0);1125 c.lineTo(w * 0.5 + dy + arrowHead, dx);1126 c.lineTo(w * 0.5 + dy, dx);1127 c.close();1128 c.fillAndStroke();1129};1130mxCellRenderer.registerShape(mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW, mxShapeArrows2QuadArrow);1131mxShapeArrows2QuadArrow.prototype.constraints = null;1132Graph.handleFactory[mxShapeArrows2QuadArrow.prototype.cst.QUAD_ARROW] = function(state)1133{1134 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)1135 {1136 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1137 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1138 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1139 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy);1140 }, function(bounds, pt)1141 {1142 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;1143 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;1144 1145 })];1146 1147 var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)1148 {1149 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1150 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1151 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1152 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height / 2 - dy - arrowHead);1153 }, function(bounds, pt)1154 {1155 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;1156 });1157 handles.push(handle2);1158 1159 return handles;1160}1161//**********************************************************************************************************************************************************1162//Triad Arrow1163//**********************************************************************************************************************************************************1164/**1165* Extends mxShape.1166*/1167function mxShapeArrows2TriadArrow(bounds, fill, stroke, strokewidth)1168{1169 mxShape.call(this);1170 this.bounds = bounds;1171 this.fill = fill;1172 this.stroke = stroke;1173 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1174 this.dy = 0.5;1175 this.dx = 0.5;1176 this.arrowHead = 0;1177};1178/**1179* Extends mxShape.1180*/1181mxUtils.extend(mxShapeArrows2TriadArrow, mxActor);1182mxShapeArrows2TriadArrow.prototype.cst = {1183 TRIAD_ARROW : 'mxgraph.arrows2.triadArrow'1184};1185/**1186* Function: paintVertexShape1187* 1188* Paints the vertex shape.1189*/1190mxShapeArrows2TriadArrow.prototype.paintVertexShape = function(c, x, y, w, h)1191{1192 c.translate(x, y);1193 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));1194 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1195 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1196 c.begin();1197 c.moveTo(w * 0.5 + arrowHead * 0.5 - dy, h - arrowHead + dy);1198 c.lineTo(w - dx, h - arrowHead + dy);1199 c.lineTo(w - dx, h - arrowHead);1200 c.lineTo(w, h - arrowHead * 0.5);1201 c.lineTo(w - dx, h);1202 c.lineTo(w - dx, h - dy);1203 c.lineTo(dx, h - dy);1204 c.lineTo(dx, h);1205 c.lineTo(0, h - arrowHead * 0.5);1206 c.lineTo(dx, h - arrowHead);1207 c.lineTo(dx, h - arrowHead + dy);1208 c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, h - arrowHead + dy);1209 c.lineTo(w * 0.5 - arrowHead * 0.5 + dy, dx);1210 c.lineTo(w * 0.5 - arrowHead * 0.5, dx);1211 c.lineTo(w * 0.5, 0);1212 c.lineTo(w * 0.5 + arrowHead * 0.5, dx);1213 c.lineTo(w * 0.5 + arrowHead * 0.5 - dy, dx);1214 c.close();1215 c.fillAndStroke();1216};1217mxCellRenderer.registerShape(mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW, mxShapeArrows2TriadArrow);1218mxShapeArrows2TriadArrow.prototype.constraints = null;1219Graph.handleFactory[mxShapeArrows2TriadArrow.prototype.cst.TRIAD_ARROW] = function(state)1220{1221 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)1222 {1223 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1224 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1225 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1226 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - dy);1227 }, function(bounds, pt)1228 {1229 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;1230 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;1231 1232 })];1233 1234 var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)1235 {1236 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1237 var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1238 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1239 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - arrowHead);1240 }, function(bounds, pt)1241 {1242 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;1243 });1244 handles.push(handle2);1245 1246 return handles;1247}1248//**********************************************************************************************************************************************************1249//Tailed Arrow1250//**********************************************************************************************************************************************************1251/**1252* Extends mxShape.1253*/1254function mxShapeArrows2TailedArrow(bounds, fill, stroke, strokewidth)1255{1256 mxShape.call(this);1257 this.bounds = bounds;1258 this.fill = fill;1259 this.stroke = stroke;1260 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1261 this.dy = 0.5;1262 this.dx = 0.5;1263 this.notch = 0;1264 this.arrowHead = 0;1265};1266/**1267* Extends mxShape.1268*/1269mxUtils.extend(mxShapeArrows2TailedArrow, mxActor);1270mxShapeArrows2TailedArrow.prototype.cst = {1271 TAILED_ARROW : 'mxgraph.arrows2.tailedArrow'1272};1273/**1274* Function: paintVertexShape1275* 1276* Paints the vertex shape.1277*/1278mxShapeArrows2TailedArrow.prototype.paintVertexShape = function(c, x, y, w, h)1279{1280 c.translate(x, y);1281 var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));1282 var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));1283 var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));1284 var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));1285 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));1286 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1287 var x2 = 0;1288 1289 if (dy2 != 0)1290 {1291 x2 = dx2 + dy2 * (dy2 - dy1) / dy2;1292 }1293 c.begin();1294 c.moveTo(0, h * 0.5 - dy2);1295 c.lineTo(dx2, h * 0.5 - dy2);1296 c.lineTo(x2, h * 0.5 - dy1);1297 c.lineTo(w - dx1, h * 0.5 - dy1);1298 c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);1299 c.lineTo(w, h * 0.5);1300 c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);1301 c.lineTo(w - dx1, h * 0.5 + dy1);1302 c.lineTo(x2, h * 0.5 + dy1);1303 c.lineTo(dx2, h * 0.5 + dy2);1304 c.lineTo(0, h * 0.5 + dy2);1305 c.lineTo(notch, h * 0.5);1306 c.close();1307 c.fillAndStroke();1308};1309mxCellRenderer.registerShape(mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW, mxShapeArrows2TailedArrow);1310mxShapeArrows2TailedArrow.prototype.constraints = null;1311Graph.handleFactory[mxShapeArrows2TailedArrow.prototype.cst.TAILED_ARROW] = function(state)1312{1313 var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)1314 {1315 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1316 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));1317 var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));1318 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);1319 }, function(bounds, pt)1320 {1321 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;1322 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;1323 1324 })];1325 1326 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)1327 {1328 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));1329 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);1330 }, function(bounds, pt)1331 {1332 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;1333 });1334 handles.push(handle2);1335 1336 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)1337 {1338 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));1339 var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));1340 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1341 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);1342 }, function(bounds, pt)1343 {1344 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;1345 });1346 handles.push(handle3);1347 1348 var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)1349 {1350 var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));1351 var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));1352 return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);1353 }, function(bounds, pt)1354 {1355 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;1356 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;1357 1358 });1359 handles.push(handle4);1360 return handles;1361}1362//**********************************************************************************************************************************************************1363//Tailed Arrow with Notch1364//**********************************************************************************************************************************************************1365/**1366* Extends mxShape.1367*/1368function mxShapeArrows2TailedNotchedArrow(bounds, fill, stroke, strokewidth)1369{1370 mxShape.call(this);1371 this.bounds = bounds;1372 this.fill = fill;1373 this.stroke = stroke;1374 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1375 this.dy = 0.5;1376 this.dx = 0.5;1377 this.notch = 0;1378 this.arrowHead = 0;1379};1380/**1381* Extends mxShape.1382*/1383mxUtils.extend(mxShapeArrows2TailedNotchedArrow, mxActor);1384mxShapeArrows2TailedNotchedArrow.prototype.cst = {1385 TAILED_NOTCHED_ARROW : 'mxgraph.arrows2.tailedNotchedArrow'1386};1387/**1388* Function: paintVertexShape1389* 1390* Paints the vertex shape.1391*/1392mxShapeArrows2TailedNotchedArrow.prototype.paintVertexShape = function(c, x, y, w, h)1393{1394 c.translate(x, y);1395 var dy1 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));1396 var dx1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));1397 var dy2 = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));1398 var dx2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));1399 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));1400 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1401 var x2 = 0;1402 1403 if (dy2 != 0)1404 {1405 x2 = dx2 + notch * (dy2 - dy1) / dy2;1406 }1407 c.begin();1408 c.moveTo(0, h * 0.5 - dy2);1409 c.lineTo(dx2, h * 0.5 - dy2);1410 c.lineTo(x2, h * 0.5 - dy1);1411 c.lineTo(w - dx1, h * 0.5 - dy1);1412 c.lineTo(w - dx1, h * 0.5 - dy1 - arrowHead);1413 c.lineTo(w, h * 0.5);1414 c.lineTo(w - dx1, h * 0.5 + dy1 + arrowHead);1415 c.lineTo(w - dx1, h * 0.5 + dy1);1416 c.lineTo(x2, h * 0.5 + dy1);1417 c.lineTo(dx2, h * 0.5 + dy2);1418 c.lineTo(0, h * 0.5 + dy2);1419 c.lineTo(notch, h * 0.5);1420 c.close();1421 c.fillAndStroke();1422};1423mxCellRenderer.registerShape(mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW, mxShapeArrows2TailedNotchedArrow);1424mxShapeArrows2TailedNotchedArrow.prototype.constraints = null;1425Graph.handleFactory[mxShapeArrows2TailedNotchedArrow.prototype.cst.TAILED_NOTCHED_ARROW] = function(state)1426{1427 var handles = [Graph.createHandle(state, ['dx1', 'dy1'], function(bounds)1428 {1429 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1430 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));1431 var dy1 = Math.max(0, Math.min(bounds.height / 2 - arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));1432 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1);1433 }, function(bounds, pt)1434 {1435 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;1436 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;1437 1438 })];1439 1440 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)1441 {1442 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));1443 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);1444 }, function(bounds, pt)1445 {1446 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;1447 });1448 handles.push(handle2);1449 1450 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)1451 {1452 var dx1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));1453 var dy1 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));1454 var arrowHead = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1455 return new mxPoint(bounds.x + bounds.width - dx1, bounds.y + bounds.height / 2 - dy1 - arrowHead);1456 }, function(bounds, pt)1457 {1458 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;1459 });1460 handles.push(handle3);1461 1462 var handle4 = Graph.createHandle(state, ['dx2', 'dy2'], function(bounds)1463 {1464 var dx2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));1465 var dy2 = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));1466 return new mxPoint(bounds.x + dx2, bounds.y + bounds.height / 2 - dy2);1467 }, function(bounds, pt)1468 {1469 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;1470 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;1471 1472 });1473 handles.push(handle4);1474 return handles;1475}1476//**********************************************************************************************************************************************************1477//Striped Arrow1478//**********************************************************************************************************************************************************1479/**1480* Extends mxShape.1481*/1482function mxShapeArrows2StripedArrow(bounds, fill, stroke, strokewidth)1483{1484 mxShape.call(this);1485 this.bounds = bounds;1486 this.fill = fill;1487 this.stroke = stroke;1488 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1489 this.dy = 0.5;1490 this.dx = 0.5;1491 this.notch = 0;1492};1493/**1494* Extends mxShape.1495*/1496mxUtils.extend(mxShapeArrows2StripedArrow, mxActor);1497mxShapeArrows2StripedArrow.prototype.cst = {1498 STRIPED_ARROW : 'mxgraph.arrows2.stripedArrow'1499};1500/**1501* Function: paintVertexShape1502* 1503* Paints the vertex shape.1504*/1505mxShapeArrows2StripedArrow.prototype.paintVertexShape = function(c, x, y, w, h)1506{1507 c.translate(x, y);1508 var dy = h * 0.5 * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));1509 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1510 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));1511 c.begin();1512 c.moveTo(notch, dy);1513 c.lineTo(w - dx, dy);1514 c.lineTo(w - dx, 0);1515 c.lineTo(w, h * 0.5);1516 c.lineTo(w - dx, h);1517 c.lineTo(w - dx, h - dy);1518 c.lineTo(notch, h - dy);1519 c.close();1520 c.moveTo(0, h - dy);1521 c.lineTo(notch * 0.16, h - dy);1522 c.lineTo(notch * 0.16, dy);1523 c.lineTo(0, dy);1524 c.close();1525 c.moveTo(notch * 0.32, h - dy);1526 c.lineTo(notch * 0.8, h - dy);1527 c.lineTo(notch * 0.8, dy);1528 c.lineTo(notch * 0.32, dy);1529 c.close();1530 c.fillAndStroke();1531 1532};1533mxCellRenderer.registerShape(mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW, mxShapeArrows2StripedArrow);1534mxShapeArrows2StripedArrow.prototype.constraints = null;1535Graph.handleFactory[mxShapeArrows2StripedArrow.prototype.cst.STRIPED_ARROW] = function(state)1536{1537 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)1538 {1539 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1540 var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1541 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy * bounds.height / 2);1542 }, function(bounds, pt)1543 {1544 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;1545 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (((pt.y - bounds.y) / bounds.height) * 2)))) / 100;1546 })];1547 1548 var handle2 = Graph.createHandle(state, ['notch'], function(bounds)1549 {1550 var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));1551 return new mxPoint(bounds.x + notch, bounds.y + bounds.height / 2);1552 }, function(bounds, pt)1553 {1554 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;1555 });1556 1557 handles.push(handle2);1558 1559 return handles;1560}1561//**********************************************************************************************************************************************************1562//Jump-In Arrow1563//**********************************************************************************************************************************************************1564/**1565* Extends mxShape.1566*/1567function mxShapeArrows2JumpInArrow(bounds, fill, stroke, strokewidth)1568{1569 mxShape.call(this);1570 this.bounds = bounds;1571 this.fill = fill;1572 this.stroke = stroke;1573 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1574 this.dy = 0.5;1575 this.dx = 0.5;1576 this.arrowHead = 40;1577};1578/**1579* Extends mxShape.1580*/1581mxUtils.extend(mxShapeArrows2JumpInArrow, mxActor);1582mxShapeArrows2JumpInArrow.prototype.cst = {1583 JUMP_IN_ARROW : 'mxgraph.arrows2.jumpInArrow'1584};1585/**1586* Function: paintVertexShape1587* 1588* Paints the vertex shape.1589*/1590mxShapeArrows2JumpInArrow.prototype.paintVertexShape = function(c, x, y, w, h)1591{1592 c.translate(x, y);1593 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));1594 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1595 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1596 c.begin();1597 c.moveTo(w - dx, 0);1598 c.lineTo(w, arrowHead * 0.5);1599 c.lineTo(w - dx, arrowHead);1600 c.lineTo(w - dx, arrowHead / 2 + dy);1601 c.arcTo(w - dx, h - arrowHead / 2 - dy, 0, 0, 0, 0, h);1602 c.arcTo(w - dx, h - arrowHead / 2 + dy, 0, 0, 1, w - dx, arrowHead / 2 - dy);1603 c.close();1604 c.fillAndStroke();1605};1606mxCellRenderer.registerShape(mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW, mxShapeArrows2JumpInArrow);1607mxShapeArrows2JumpInArrow.prototype.constraints = null;1608Graph.handleFactory[mxShapeArrows2JumpInArrow.prototype.cst.JUMP_IN_ARROW] = function(state)1609{1610 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)1611 {1612 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1613 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1614 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1615 1616 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead / 2 - dy);1617 }, function(bounds, pt)1618 {1619 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;1620 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2, bounds.y + parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead)) / 2 - pt.y))) / 100;1621 1622 })];1623 1624 var handle2 = Graph.createHandle(state, ['arrowHead'], function(bounds)1625 {1626 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));1627 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1628 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + arrowHead);1629 }, function(bounds, pt)1630 {1631 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;1632 });1633 1634 handles.push(handle2);1635 return handles;1636}1637//**********************************************************************************************************************************************************1638//U Turn Arrow1639//**********************************************************************************************************************************************************1640/**1641* Extends mxShape.1642*/1643function mxShapeArrows2UTurnArrow(bounds, fill, stroke, strokewidth)1644{1645 mxShape.call(this);1646 this.bounds = bounds;1647 this.fill = fill;1648 this.stroke = stroke;1649 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1650 this.dy = 0.5;1651 this.dx = 0.5;1652 this.arrowHead = 40;1653};1654/**1655* Extends mxShape.1656*/1657mxUtils.extend(mxShapeArrows2UTurnArrow, mxActor);1658mxShapeArrows2UTurnArrow.prototype.cst = {1659 U_TURN_ARROW : 'mxgraph.arrows2.uTurnArrow'1660};1661/**1662* Function: paintVertexShape1663* 1664* Paints the vertex shape.1665*/1666mxShapeArrows2UTurnArrow.prototype.paintVertexShape = function(c, x, y, w, h)1667{1668 c.translate(x, y);1669 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));1670 var arrowHead = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'arrowHead', this.arrowHead))));1671 var dx = (h - arrowHead / 2 + dy) / 2;1672 var dx2 = Math.max(0, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2)));1673 1674 c.begin();1675 c.moveTo(dx, 0);1676 c.lineTo(dx + dx2, arrowHead * 0.5);1677 c.lineTo(dx, arrowHead);1678 c.lineTo(dx, arrowHead / 2 + dy);1679 c.arcTo(dx - 2 * dy, dx - 2 * dy, 0, 0, 0, dx, h - 2 * dy);1680 c.lineTo(Math.max(w, dx), h - 2 * dy);1681 c.lineTo(Math.max(w, dx), h);1682 c.lineTo(dx, h);1683 c.arcTo(dx, dx, 0, 0, 1, dx, arrowHead / 2 - dy);1684 c.close();1685 c.fillAndStroke();1686};1687mxCellRenderer.registerShape(mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW, mxShapeArrows2UTurnArrow);1688mxShapeArrows2UTurnArrow.prototype.constraints = null;1689Graph.handleFactory[mxShapeArrows2UTurnArrow.prototype.cst.U_TURN_ARROW] = function(state)1690{1691 var handles = [Graph.createHandle(state, ['dy'], function(bounds)1692 {1693 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1694 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1695 var dx = (bounds.height - arrowHead / 2 + dy) / 2;1696 return new mxPoint(bounds.x + dx, bounds.y + arrowHead / 2 - dy);1697 }, function(bounds, pt)1698 {1699 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;1700 1701 })];1702 var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)1703 {1704 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1705 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1706 var dx = (bounds.height - arrowHead / 2 + dy) / 2;1707 1708 var dx2 = Math.max(0, Math.min(bounds.width - dx, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));1709 return new mxPoint(bounds.x + dx + dx2, bounds.y + arrowHead / 2);1710 }, function(bounds, pt)1711 {1712 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1713 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1714 var dx = (bounds.height - arrowHead / 2 + dy) / 2;1715 this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(Math.max(bounds.width, dx), pt.x - bounds.x - dx))) / 100;1716 });1717 1718 handles.push(handle2);1719 var handle3 = Graph.createHandle(state, ['arrowHead'], function(bounds)1720 {1721 var arrowHead = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'arrowHead', this.arrowHead))));1722 var dy = Math.max(0, Math.min(arrowHead, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));1723 var dx = (bounds.height - arrowHead / 2 + dy) / 2;1724 return new mxPoint(bounds.x + dx, bounds.y + arrowHead);1725 }, function(bounds, pt)1726 {1727 this.state.style['arrowHead'] = Math.round(100 * Math.max(2 * parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)), Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;1728 });1729 1730 handles.push(handle3);1731 return handles;...
test.js
Source:test.js
...24 coroutine(run(), null, [], t.ifError)25})26test('passes in at INSERT', (t) => {27 function* run () {28 const x = yield Promise.resolve(createHandle(null, true))29 t.equal(x, 'in')30 t.end()31 }32 coroutine(run(), null, ['in'], t.ifError)33})34test('passes in later at INSERT', (t) => {35 function* run () {36 yield Promise.resolve('out1')37 const x = yield Promise.resolve(createHandle(null, true))38 t.equal(x, 'in')39 t.end()40 }41 coroutine(run(), null, ['in'], t.ifError)42})43test('works with two queue items', (t) => {44 function* run () {45 const x1 = yield Promise.resolve(createHandle(null, true))46 const x2 = yield Promise.resolve(createHandle(null, true))47 t.equal(x1, 'in1')48 t.equal(x2, 'in2')49 t.end()50 }51 coroutine(run(), null, ['in1', 'in2'], (err) => {52 t.ifError(err)53 })54})55test('works with INSERT & non-handles', (t) => {56 function* run () {57 yield Promise.resolve('out1')58 const x1 = yield Promise.resolve(createHandle(null, true))59 yield Promise.resolve()60 const x2 = yield Promise.resolve(createHandle(null, true))61 yield Promise.resolve()62 t.equal(x1, 'in1')63 t.equal(x2, 'in2')64 t.end()65 }66 const gen = run()67 coroutine(gen, null, ['in1', 'in2'], (err) => {68 t.ifError(err)69 })70})71test('handles the end properly', (t) => {72 t.plan(2 + 1)73 function* run () {74 yield Promise.resolve()...
resizable.js
Source:resizable.js
...75 });76 el.appendChild(left);77 78 // tl handle79 el.appendChild(createHandle({80 ...handleBaseStyle,81 left: -handleMiddle + 'px',82 top: -handleMiddle + 'px',83 }));84 85 // tr handle86 el.appendChild(createHandle({87 ...handleBaseStyle,88 right: -handleMiddle + 'px',89 top: -handleMiddle + 'px',90 }));91 // br handle92 el.appendChild(createHandle({93 ...handleBaseStyle,94 right: -handleMiddle + 'px',95 bottom: -handleMiddle + 'px',96 }));97 98 // bl handle99 el.appendChild(createHandle({100 ...handleBaseStyle,101 left: -handleMiddle + 'px',102 bottom: -handleMiddle + 'px',103 }));104}105function createEdge(style = {}) {106 const edge = document.createElement('div');107 edge.className = 'resizable-edge';108 edge.style.position = 'absolute';109 edge.style.backgroundColor = 'black';110 for(let [key, value] of Object.entries(style)) {111 edge.style[key] = value;112 }113 return edge;114}115function createHandle(style = {}) {116 const handle = document.createElement('div');117 handle.className = 'resizable-handle';118 handle.style.position = 'absolute';119 handle.style.border = '1px solid black';120 handle.style.backgroundColor = 'white';121 122 for(let [key, value] of Object.entries(style)) {123 handle.style[key] = value;124 }125 return handle;126}127function removeChildren(el, selector) {128 [...el.querySelectorAll(selector)].forEach(edge => edge.remove());129}
index.js
Source:index.js
...29 insert = !!handle[INSERT]30 }31 if (insert && queue.length === 0) {32 // wait for a new message33 return cb(null, createHandle(null, insert))34 }35 try {36 const {done, value: task} = gen.next(insert ? queue.shift() : value)37 if (done) return cb(null, RESTART)38 tick(task)39 } catch (err) {40 cb(err)41 }42 }43 tick(Promise.resolve(val))44}45const createRespond = (storage, bot, conversation, onError) => {46 const createCtx = (user) => {47 const insert = () => {48 return Promise.resolve(createHandle(undefined, true))49 }50 const send = (...args) => {51 bot.send(user, ...args)52 return Promise.resolve()53 }54 const prompt = (...args) => {55 bot.send(user, ...args)56 return Promise.resolve(createHandle(undefined, true))57 }58 // todo: migrate to the levelUP API, wrap in promises here59 const ctx = Object.create(storage(user))60 ctx.msg = insert61 ctx.send = send62 ctx.prompt = prompt63 return ctx64 }65 const gens = {}66 const tasks = {}67 const queues = {}68 return function respond (user, msg) {69 const loop = (val) => {70 let gen = gens[user]...
Instructorpage.js
Source:Instructorpage.js
...11 };12 this.createHandle = this.createHandle.bind(this);13 this.reup = this.reup.bind(this);14 }15 createHandle() {16 this.setState({17 creating: !this.state.creating18 });19 this.reup();20 }21 componentDidMount() {22 fetch(`https://final-api-396.herokuapp.com/instructors/${this.props.instructor._id}/sessions`)23 .then(response => response.json())24 .then(data => {25 const _li = data.map((_s) => 26 <Instructorscheduledclass key={_s._id} ses={_s} rhandle={this.reup} />27 );28 this.setState({29 open: _li...
handle_tests.js
Source:handle_tests.js
...5 test_long_parent_chain(100);6 test_invalid_creation();7}8function test_sanity() {9 var parent = createHandle(),10 child = parent.createHandle(),11 grandchild = child.createHandle();12 do_check_neq(child, parent);13 do_check_eq(child.parent, parent);14 do_check_eq(parent.parent, null);15 do_check_eq(grandchild.parent.parent, parent);16 do_check_true(child.isValid);17 do_check_true(parent.isValid);18 parent.invalidate();19}20function test_safe_iteration() {21 var handle = createHandle(),22 keys = [];23 handle.foo = 42;24 handle.self = handle;25 for (var k in handle)26 keys[keys.length] = k;27 do_check_eq(keys.sort().join("~"),28 "foo~self");29 handle.invalidate();30}31function test_local_invalidation() {32 var parent = createHandle(),33 child = parent.createHandle();34 dump("test_local_invalidation\n");35 36 child.invalidate();37 do_check_false(child.isValid);38 do_check_true(parent.isValid);39 child = parent.createHandle();40 do_check_true(child.isValid);41 parent.invalidate();42 parent.invalidate();43 do_check_false(child.isValid);44 do_check_false(parent.isValid);45 parent = createHandle();46 child = parent.createHandle();47 child = child.createHandle();48 var uncle = parent.createHandle(),49 sibling = child.parent.createHandle();50 do_check_eq(child.parent.parent, parent);51 do_check_true(child.parent.isValid);52 child.parent.invalidate();53 do_check_false(child.isValid);54 do_check_true(parent.isValid);55 do_check_false(sibling.isValid);56 do_check_true(uncle.isValid);57 parent.invalidate();58}59function test_long_parent_chain(len) {60 const ancestor = createHandle();61 for (var handle = ancestor, i = 0; i < len; ++i)62 handle = handle.createHandle();63 const child = handle;64 while (handle != ancestor)65 handle = handle.parent;66 do_check_true(child.isValid);67 ancestor.invalidate();68 do_check_false(child.isValid);69}70function test_invalid_creation() {71 var parent = createHandle(),72 child = parent.createHandle();73 parent.invalidate();74 do_check_eq(child.parent, null);75 var threw = false;76 try { child.createHandle(); }77 catch (x) { threw = true; }78 do_check_true(threw);...
cleanUnitInput.js
Source:cleanUnitInput.js
...30) {31 const input = { ...unitInput };32 // Slugify the handle input33 if (typeof input.slug === "string") {34 input.handle = await createHandle(35 context,36 getSlug(input.slug),37 unitId,38 shopId39 );40 delete input.slug;41 }42 // If a title is supplied, and the currently stored unit doesn't have a handle,43 // then slugify the title and save it as the new handle (slug)44 if (typeof input.title === "string" && !currentUnitHandle && !input.handle) {45 input.handle = await createHandle(46 context,47 getSlug(input.title),48 unitId,49 shopId50 );51 }52 // Unit.validate call will ensure most validity, but there are certain fields53 // that we never want to allow arbitrary values for because they are controlled by the54 // system. We'll clear those here if someone is trying to set them.55 unitFieldsThatShouldNotBeDirectlySet.forEach((forbiddenField) => {56 delete input[forbiddenField];57 });58 return input;59}
run.js
Source:run.js
1import { create, options } from 'linex'2// Runs each test with and without object-fallback.3export default (name, runner) => {4 const createHandle = (fallback, store) => {5 return create(store)6 }7 test(`${name}.`, () => {8 options({ fallback: false })9 runner(false, createHandle.bind(null, false))10 })11 test(`${name} with fallback option.`, () => {12 options({ fallback: true })13 runner(true, createHandle.bind(null, true))14 })...
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.screenshot({path: 'example.png'});6 await browser.close();7})();8const puppeteer = require('puppeteer');9(async () => {10 const browser = await puppeteer.launch();11 const page = await browser.newPage();12 const elementHandle = await page.$('.example-class');13 await elementHandle.screenshot({path: 'example.png'});14 await browser.close();15})();16const puppeteer = require('puppeteer');17(async () => {18 const browser = await puppeteer.launch();19 const page = await browser.newPage();20 await page.screenshot({path: 'example.png', fullPage: true});21 await browser.close();22})();23const puppeteer = require('puppeteer');24(async () => {25 const browser = await puppeteer.launch();26 const page = await browser.newPage();27 await page.screenshot({path: 'example.png', fullPage: true});28 await browser.close();29})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 const handle = await page.evaluateHandle(() => document.body);6 await browser.close();7})();8const puppeteer = require('puppeteer');9(async () => {10 const browser = await puppeteer.launch({headless: false});11 const page = await browser.newPage();12 const handle = await page.evaluateHandle(() => document.body);13 await browser.close();14})();15const puppeteer = require('puppeteer');16(async () => {17 const browser = await puppeteer.launch({headless: false});18 const page = await browser.newPage();19 const handle = await page.evaluateHandle(() => document.body);20 await browser.close();21})();22const puppeteer = require('puppeteer');23(async () => {24 const browser = await puppeteer.launch({headless: false});25 const page = await browser.newPage();26 const handle = await page.evaluateHandle(() => document.body);27 await browser.close();28})();29const puppeteer = require('puppeteer');30(async () => {31 const browser = await puppeteer.launch({headless: false});32 const page = await browser.newPage();33 const handle = await page.evaluateHandle(() => document.body);34 await browser.close();35})();36const puppeteer = require('puppeteer');37(async () => {38 const browser = await puppeteer.launch({headless: false});39 const page = await browser.newPage();
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const handle = await page.evaluateHandle(() => document.body);6 await page.evaluate(body => body.style.backgroundColor = 'red', handle);7 await handle.dispose();8 await browser.close();9})();10const puppeteer = require('puppeteer');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 const handle = await page.evaluateHandle(() => document.body);15 await page.evaluate(body => body.style.backgroundColor = 'red', handle);16 await handle.dispose();17 await browser.close();18})();19const puppeteer = require('puppeteer');20(async () => {21 const browser = await puppeteer.launch();22 const page = await browser.newPage();23 const handle = await page.evaluateHandle(() => document.body);24 await page.evaluate(body => body.style.backgroundColor = 'red', handle);25 await handle.dispose();26 await browser.close();27})();28const puppeteer = require('puppeteer');29(async () => {30 const browser = await puppeteer.launch();31 const page = await browser.newPage();32 const handle = await page.evaluateHandle(() => document.body);33 await page.evaluate(body => body.style.backgroundColor = 'red', handle);34 await handle.dispose();35 await browser.close();36})();37const puppeteer = require('puppeteer');38(async () => {39 const browser = await puppeteer.launch();40 const page = await browser.newPage();41 const handle = await page.evaluateHandle(() => document.body);42 await page.evaluate(body => body.style.backgroundColor = 'red', handle);43 await handle.dispose();44 await browser.close();45})();46const puppeteer = require('puppeteer
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const handle = await page.evaluateHandle(() => document.body);6 console.log(handle);7 await browser.close();8})();9JSHandle.evaluate(pageFunction[, ...args])10const puppeteer = require('puppeteer');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 const handle = await page.evaluateHandle(() => document.body);15 const resultHandle = await handle.evaluateHandle(body => body.querySelector('div'));16 console.log(resultHandle);17 await browser.close();18})();19JSHandle.asElement()20const puppeteer = require('puppeteer');21(async () => {22 const browser = await puppeteer.launch();23 const page = await browser.newPage();24 const handle = await page.evaluateHandle(() => document.body);25 const element = await handle.asElement();26 console.log(element);27 await browser.close();28})();29JSHandle.getProperty(propertyName)30const puppeteer = require('puppeteer');31(async () => {32 const browser = await puppeteer.launch();33 const page = await browser.newPage();34 const handle = await page.evaluateHandle(() => document.body);35 const propertyHandle = await handle.getProperty('innerHTML');36 const propertyValue = await propertyHandle.jsonValue();37 console.log(propertyValue);38 await browser.close();39})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const handle = await page.evaluateHandle(() => document.body);6 await page.evaluate(body => body.style.background = 'red', handle);7 await browser.close();8})();9const puppeteer = require('puppeteer');10(async () => {11 const browser = await puppeteer.launch();12 const page = await browser.newPage();13 const handle = await page.evaluateHandle(() => document.body);14 await page.evaluate(body => body.style.background = 'red', handle);15 await browser.close();16})();17const puppeteer = require('puppeteer');18(async () => {19 const browser = await puppeteer.launch();20 const page = await browser.newPage();21 const handle = await page.evaluateHandle(() => document.body);22 await page.evaluate(body => body.style.background = 'red', handle);23 await browser.close();24})();25const puppeteer = require('puppeteer');26(async () => {27 const browser = await puppeteer.launch();28 const page = await browser.newPage();29 const handle = await page.evaluateHandle(() => document.body);30 await page.evaluate(body => body.style.background = 'red', handle);31 await browser.close();32})();33const puppeteer = require('puppeteer');34(async () => {35 const browser = await puppeteer.launch();36 const page = await browser.newPage();37 const handle = await page.evaluateHandle(() => document.body);38 await page.evaluate(body => body.style.background = 'red', handle);39 await browser.close();40})();41const puppeteer = require('puppeteer');42(async () => {43 const browser = await puppeteer.launch();
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 const handle = await page.evaluateHandle(() => document.body);7 await fs.writeFileSync('handle.json', JSON.stringify(handle, null, 2));8 await browser.close();9})();10const puppeteer = require('puppeteer');11const fs = require('fs');12(async () => {13 const browser = await puppeteer.launch();14 const page = await browser.newPage();15 const handle = await fs.readFileSync('handle.json');16 await page.evaluate((handle) => {17 console.log(handle);18 }, handle);19 await browser.close();20})();
Using AI Code Generation
1(async () => {2 const browser = await puppeteer.launch();3 const page = await browser.newPage();4 await page.screenshot({path: 'example.png'});5 await browser.close();6})();7(async () => {8 const browser = await puppeteer.launch();9 const page = await browser.newPage();10 await page.screenshot({path: 'example.png'});11 await browser.close();12})();13(async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 await page.screenshot({path: 'example.png'});17 await browser.close();18})();19(async () => {20 const browser = await puppeteer.launch();21 const page = await browser.newPage();22 await page.screenshot({path: 'example.png'});23 await browser.close();24})();25(async () => {26 const browser = await puppeteer.launch();27 const page = await browser.newPage();28 await page.screenshot({path: 'example.png'});29 await browser.close();30})();31(async () => {32 const browser = await puppeteer.launch();33 const page = await browser.newPage();34 await page.screenshot({path: 'example.png'});35 await browser.close();36})();37(async () => {38 const browser = await puppeteer.launch();39 const page = await browser.newPage();40 await page.screenshot({path: 'example.png'});41 await browser.close();42})();43(async () => {44 const browser = await puppeteer.launch();45 const page = await browser.newPage();
Using AI Code Generation
1const browser = await puppeteer.launch();2const page = await browser.newPage();3const handle = await page.evaluateHandle(() => document.body);4await browser.close();5const browser = await chromium.launch();6const context = await browser.newContext();7const page = await context.newPage();8const handle = await page.evaluateHandle(() => document.body);9await browser.close();10const browser = await puppeteer.launch();11const page = await browser.newPage();12await browser.close();13const browser = await chromium.launch();14const context = await browser.newContext();15const page = await context.newPage();16await browser.close();17const browser = await puppeteer.launch();18const context = await browser.createIncognitoBrowserContext();19const page = await context.newPage();20await browser.close();21const browser = await chromium.launch();22const context = await browser.newContext();23const page = await context.newPage();24await browser.close();25const browser = await puppeteer.launch();26const browser = await chromium.launch();
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: 'example.png' });6 const element = await page.$('h1');7 const handle = await element.asElement();8 console.log(handle);9 await browser.close();10})();11const puppeteer = require('puppeteer');12(async () => {13 const browser = await puppeteer.launch();14 const page = await browser.newPage();15 await page.screenshot({ path: 'example.png' });16 const element = await page.$('h1');17 const handle = await element.asElement();18 console.log(handle);19 await browser.close();20})();21const puppeteer = require('puppeteer');22(async () => {23 const browser = await puppeteer.launch();24 const page = await browser.newPage();25 await page.screenshot({ path: 'example.png' });26 const element = await page.$('h1');27 const handle = await element.asElement();28 console.log(handle);29 await browser.close();30})();31const puppeteer = require('puppeteer');32(async () => {33 const browser = await puppeteer.launch();34 const page = await browser.newPage();35 await page.screenshot({ path: 'example.png' });36 const element = await page.$('h1');37 const handle = await element.asElement();38 console.log(handle);39 await browser.close();40})();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!