clone

a browser-first diagram editor with live svg previews, local drafts and encrypted, accountless sharing

main
diagramzip / renderers / browser-run / frames / diagramsnet / vendor / assets / shapes / mxBasic.js
mxBasic.js 119.7K
1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */4//**********************************************************************************************************************************************************5// Cross6//**********************************************************************************************************************************************************7/**8* Extends mxShape.9*/10function mxShapeBasicCross(bounds, fill, stroke, strokewidth)11{12 mxShape.call(this);13 this.bounds = bounds;14 this.fill = fill;15 this.stroke = stroke;16 this.strokewidth = (strokewidth != null) ? strokewidth : 1;17 this.dx = 0.5;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxShapeBasicCross, mxActor);2425mxShapeBasicCross.prototype.cst = {CROSS : 'mxgraph.basic.cross2'};2627/**28* Function: paintVertexShape29* 30* Paints the vertex shape.31*/32mxShapeBasicCross.prototype.paintVertexShape = function(c, x, y, w, h)33{34 c.translate(x, y);3536 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));3738 c.begin();39 c.moveTo(w * 0.5 + dx, 0);40 c.lineTo(w * 0.5 + dx, h * 0.5 - dx);41 c.lineTo(w, h * 0.5 - dx);42 c.lineTo(w, h * 0.5 + dx);43 c.lineTo(w * 0.5 + dx, h * 0.5 + dx);44 c.lineTo(w * 0.5 + dx, h);45 c.lineTo(w * 0.5 - dx, h);46 c.lineTo(w * 0.5 - dx, h * 0.5 + dx);47 c.lineTo(0, h * 0.5 + dx);48 c.lineTo(0, h * 0.5 - dx);49 c.lineTo(w * 0.5 - dx, h * 0.5 - dx);50 c.lineTo(w * 0.5 - dx, 0);51 c.close();52 c.fillAndStroke();53};5455mxCellRenderer.registerShape(mxShapeBasicCross.prototype.cst.CROSS, mxShapeBasicCross);5657mxShapeBasicCross.prototype.constraints = null;5859Graph.handleFactory[mxShapeBasicCross.prototype.cst.CROSS] = function(state)60{61 var handles = [Graph.createHandle(state, ['dx'], function(bounds)62 {63 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));6465 return new mxPoint(bounds.x + bounds.width / 2 + dx, bounds.y + bounds.height / 2 - dx);66 }, function(bounds, pt)67 {68 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x - bounds.width / 2))) / 100;69 })];70 71 return handles;72};7374//**********************************************************************************************************************************************************75// Rectangular Callout76//**********************************************************************************************************************************************************77/**78* Extends mxShape.79*/80function mxShapeBasicRectCallout(bounds, fill, stroke, strokewidth)81{82 mxShape.call(this);83 this.bounds = bounds;84 this.fill = fill;85 this.stroke = stroke;86 this.strokewidth = (strokewidth != null) ? strokewidth : 1;87 this.dy = 0.5;88 this.dx = 0.5;89};9091/**92* Extends mxShape.93*/94mxUtils.extend(mxShapeBasicRectCallout, mxActor);9596mxShapeBasicRectCallout.prototype.customProperties = [97 {name: 'dx', dispName: 'Callout Position', type: 'float', min:0, defVal:30},98 {name: 'dy', dispName: 'Callout Size', type: 'float', min:0, defVal:15}99];100101mxShapeBasicRectCallout.prototype.cst = {RECT_CALLOUT : 'mxgraph.basic.rectCallout'};102103/**104* Function: paintVertexShape105* 106* Paints the vertex shape.107*/108mxShapeBasicRectCallout.prototype.paintVertexShape = function(c, x, y, w, h)109{110 c.translate(x, y);111112 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));113 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));114115 c.begin();116 c.moveTo(dx - dy * 0.5, h - dy);117 c.lineTo(0, h - dy);118 c.lineTo(0, 0);119 c.lineTo(w, 0);120 c.lineTo(w, h - dy);121 c.lineTo(dx + dy * 0.5, h - dy);122 c.lineTo(dx - dy, h);123 c.close();124 c.fillAndStroke();125};126127mxShapeBasicRectCallout.prototype.getLabelMargins = function()128{129 if (mxUtils.getValue(this.style, 'boundedLbl', false))130 {131 return new mxRectangle(0, 0, 0, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy)) * this.scale);132 }133 134 return null;135};136137mxCellRenderer.registerShape(mxShapeBasicRectCallout.prototype.cst.RECT_CALLOUT, mxShapeBasicRectCallout);138139Graph.handleFactory[mxShapeBasicRectCallout.prototype.cst.RECT_CALLOUT] = function(state)140{141 var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)142 {143 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));144 var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));145146 return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);147 }, function(bounds, pt)148 {149 var y = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) * 0.6;150 this.state.style['dx'] = Math.round(100 * Math.max(y, Math.min(bounds.width - y, pt.x - bounds.x))) / 100;151 this.state.style['dy'] = Math.round(Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y)));152 })];153 154 return handles;155};156157mxShapeBasicRectCallout.prototype.getConstraints = function(style, w, h)158{159 var constr = [];160 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));161 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));162163 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));164 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));165 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));166 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));167 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));168 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));169 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy));170 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx - dy, h));171 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));172 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));173174 return (constr);175}176177//**********************************************************************************************************************************************************178// Rounded Rectangular Callout179//**********************************************************************************************************************************************************180/**181* Extends mxShape.182*/183function mxShapeBasicRoundRectCallout(bounds, fill, stroke, strokewidth)184{185 mxShape.call(this);186 this.bounds = bounds;187 this.fill = fill;188 this.stroke = stroke;189 this.strokewidth = (strokewidth != null) ? strokewidth : 1;190 this.dy = 0.5;191 this.dx = 0.5;192 this.size = 10;193};194195/**196* Extends mxShape.197*/198mxUtils.extend(mxShapeBasicRoundRectCallout, mxActor);199200mxShapeBasicRoundRectCallout.prototype.cst = {ROUND_RECT_CALLOUT : 'mxgraph.basic.roundRectCallout'};201202mxShapeBasicRoundRectCallout.prototype.getLabelMargins = mxShapeBasicRectCallout.prototype.getLabelMargins;203204mxShapeBasicRoundRectCallout.prototype.customProperties = [205 {name: 'size', dispName: 'Arc Size', type: 'float', min:0, defVal:5},206 {name: 'dx', dispName: 'Callout Position', type: 'float', min:0, defVal:30},207 {name: 'dy', dispName: 'Callout Size', type: 'float', min:0, defVal:15}208];209210/**211* Function: paintVertexShape212* 213* Paints the vertex shape.214*/215mxShapeBasicRoundRectCallout.prototype.paintVertexShape = function(c, x, y, w, h)216{217 c.translate(x, y);218219 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));220 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));221 var r = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'size', this.size))));222223 r = Math.min((h - dy) / 2, w / 2, r);224 dx = Math.max(r + dy * 0.5, dx);225 dx = Math.min(w - r - dy * 0.5, dx);226 227 c.begin();228 c.moveTo(dx - dy * 0.5, h - dy);229 c.lineTo(r, h - dy);230 c.arcTo(r, r, 0, 0, 1, 0, h - dy - r);231 c.lineTo(0, r);232 c.arcTo(r, r, 0, 0, 1, r, 0);233 c.lineTo(w - r, 0);234 c.arcTo(r, r, 0, 0, 1, w, r);235 c.lineTo(w, h - dy - r);236 c.arcTo(r, r, 0, 0, 1, w - r, h - dy);237 c.lineTo(dx + dy * 0.5, h - dy);238 c.arcTo(1.9 * dy, 1.4 * dy, 0, 0, 1, dx - dy, h);239 c.arcTo(0.9 * dy, 1.4 * dy, 0, 0, 0, dx - dy * 0.5, h - dy);240 c.close();241 c.fillAndStroke();242};243244mxCellRenderer.registerShape(mxShapeBasicRoundRectCallout.prototype.cst.ROUND_RECT_CALLOUT, mxShapeBasicRoundRectCallout);245246mxShapeBasicRoundRectCallout.prototype.constraints = null;247248Graph.handleFactory[mxShapeBasicRoundRectCallout.prototype.cst.ROUND_RECT_CALLOUT] = function(state)249{250 return [Graph.createHandle(state, ['dx', 'dy'], function(bounds)251 {252 var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));253 var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));254255 return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);256 }, function(bounds, pt)257 {258 var y = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) * 0.6;259 this.state.style['dx'] = Math.round(100 * Math.max(y, Math.min(bounds.width - y, pt.x - bounds.x))) / 100;260 this.state.style['dy'] = Math.round(Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y)));261 }), Graph.createHandle(state, ['size'], function(bounds)262 {263 var size = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'size', this.size))));264265 return new mxPoint(bounds.x + bounds.width - size, bounds.y + 10);266 }, function(bounds, pt)267 {268 var dy = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy));269 this.state.style['size'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, (bounds.height - dy) / 2, bounds.x + bounds.width - pt.x))) / 100;270 })];271};272273mxShapeBasicRoundRectCallout.prototype.getConstraints = function(style, w, h)274{275 var constr = [];276 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));277 var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));278 var r = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'size', this.size))));279280 r = Math.min((h - dy) / 2, w / 2, r);281 dx = Math.max(r + dy * 0.5, dx);282 dx = Math.min(w - r - dy * 0.5, dx);283 284 if (r < w * 0.25)285 {286 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));287 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));288 }289 290 if (r < (h - dy) * 0.25)291 {292 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.25));293 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.75));294 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.25));295 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.75));296 }297298 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.293, r * 0.293));299 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));300 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.293, r * 0.293));301 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));302 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));303 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.293, h - dy - r * 0.293));304 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.293, h - dy - r * 0.293));305 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx - dy, h));306307 return (constr);308}309310//**********************************************************************************************************************************************************311// Wave312//**********************************************************************************************************************************************************313/**314* Extends mxShape.315*/316function mxShapeBasicWave(bounds, fill, stroke, strokewidth)317{318 mxShape.call(this);319 this.bounds = bounds;320 this.fill = fill;321 this.stroke = stroke;322 this.strokewidth = (strokewidth != null) ? strokewidth : 1;323 this.dy = 0.5;324};325326/**327* Extends mxShape.328*/329mxUtils.extend(mxShapeBasicWave, mxActor);330331mxShapeBasicWave.prototype.customProperties = [332 {name: 'dy', dispName: 'Wave Size', type: 'float', min:0, max:1, defVal: 0.3}333];334335mxShapeBasicWave.prototype.cst = {WAVE : 'mxgraph.basic.wave2'};336337/**338* Function: paintVertexShape339* 340* Paints the vertex shape.341*/342mxShapeBasicWave.prototype.paintVertexShape = function(c, x, y, w, h)343{344 c.translate(x, y);345346 var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));347 var fy = 1.4348 349 c.begin();350 c.moveTo(0, dy / 2);351 c.quadTo(w / 6, dy * (1 - fy), w / 3, dy / 2);352 c.quadTo(w / 2, dy * fy, w * 2 / 3, dy / 2);353 c.quadTo(w * 5 / 6, dy * (1 - fy), w, dy / 2);354 c.lineTo(w, h - dy / 2);355 c.quadTo(w * 5 / 6, h - dy * fy, w * 2 / 3, h - dy / 2);356 c.quadTo(w / 2, h - dy * (1 - fy), w / 3, h - dy / 2);357 c.quadTo(w / 6, h - dy * fy, 0, h - dy / 2);358 c.close();359 c.fillAndStroke();360};361362mxCellRenderer.registerShape(mxShapeBasicWave.prototype.cst.WAVE, mxShapeBasicWave);363364mxShapeBasicWave.prototype.constraints = null;365366Graph.handleFactory[mxShapeBasicWave.prototype.cst.WAVE] = function(state)367{368 var handles = [Graph.createHandle(state, ['dy'], function(bounds)369 {370 var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));371372 return new mxPoint(bounds.x + bounds.width / 2, bounds.y + dy * bounds.height);373 }, function(bounds, pt)374 {375 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;376 })];377378 return handles;379};380381mxShapeBasicWave.prototype.getConstraints = function(style, w, h)382{383 var constr = [];384 var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));385 var fy = 1.4386 387 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5));388 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 6, h * 0.015));389 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 3, dy * 0.5));390 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, dy * 0.95));391 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.67, dy * 0.5));392 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.83, h * 0.015));393 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5));394 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.5));395 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy * 0.5));396 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.83, h - dy * 0.95));397 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.67, h - dy * 0.5));398 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h - dy * 0.04));399 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 3, h - dy * 0.5));400 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 6, h - dy * 0.95));401 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy * 0.5));402 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5));403404 return (constr);405}406407//**********************************************************************************************************************************************************408//Octagon409//**********************************************************************************************************************************************************410/**411* Extends mxShape.412*/413function mxShapeBasicOctagon(bounds, fill, stroke, strokewidth)414{415 mxShape.call(this);416 this.bounds = bounds;417 this.fill = fill;418 this.stroke = stroke;419 this.strokewidth = (strokewidth != null) ? strokewidth : 1;420 this.dx = 0.5;421};422423/**424* Extends mxShape.425*/426mxUtils.extend(mxShapeBasicOctagon, mxActor);427428mxShapeBasicOctagon.prototype.customProperties = [429 {name: 'dx', dispName: 'Cutoff Size', type: 'float', min:0, defVal:15}430];431432mxShapeBasicOctagon.prototype.cst = {OCTAGON : 'mxgraph.basic.octagon2'};433434/**435* Function: paintVertexShape436* 437* Paints the vertex shape.438*/439mxShapeBasicOctagon.prototype.paintVertexShape = function(c, x, y, w, h)440{441 c.translate(x, y);442443 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;444445 dx = Math.min(w * 0.5, h * 0.5, dx);446 447 c.begin();448 c.moveTo(dx, 0);449 c.lineTo(w - dx, 0);450 c.lineTo(w, dx);451 c.lineTo(w, h - dx);452 c.lineTo(w - dx, h);453 c.lineTo(dx, h);454 c.lineTo(0, h - dx);455 c.lineTo(0, dx);456 c.close();457 c.fillAndStroke();458};459460mxCellRenderer.registerShape(mxShapeBasicOctagon.prototype.cst.OCTAGON, mxShapeBasicOctagon);461462mxShapeBasicOctagon.prototype.constraints = null;463464Graph.handleFactory[mxShapeBasicOctagon.prototype.cst.OCTAGON] = function(state)465{466 var handles = [Graph.createHandle(state, ['dx'], function(bounds)467 {468 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));469470 return new mxPoint(bounds.x + dx, bounds.y + dx);471 }, function(bounds, pt)472 {473 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;474 })];475 476 return handles;477};478479mxShapeBasicOctagon.prototype.getConstraints = function(style, w, h)480{481 var constr = [];482 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;483484 dx = Math.min(w * 0.5, h * 0.5, dx) * 0.5;485 486 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));487 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));488 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));489 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));490 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));491 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx));492 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dx));493 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h - dx));494495 return (constr);496}497498//**********************************************************************************************************************************************************499//Isometric Cube500//**********************************************************************************************************************************************************501/**502* Extends mxShape.503*/504function mxShapeBasicIsoCube(bounds, fill, stroke, strokewidth)505{506 mxShape.call(this);507 this.bounds = bounds;508 this.fill = fill;509 this.stroke = stroke;510 this.strokewidth = (strokewidth != null) ? strokewidth : 1;511 this.isoAngle = 15;512};513514/**515* Extends mxShape.516*/517mxUtils.extend(mxShapeBasicIsoCube, mxActor);518519mxShapeBasicIsoCube.prototype.customProperties = [520 {name: 'isoAngle', dispName: 'Perspective Angle', type: 'float', min:0, defVal:15}521];522523mxShapeBasicIsoCube.prototype.cst = {ISO_CUBE : 'mxgraph.basic.isocube'};524525/**526* Function: paintVertexShape527* 528* Paints the vertex shape.529*/530mxShapeBasicIsoCube.prototype.paintVertexShape = function(c, x, y, w, h)531{532 c.translate(x, y);533534 var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;535 var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);536 537 c.begin();538 c.moveTo(w * 0.5, 0);539 c.lineTo(w, isoH);540 c.lineTo(w, h - isoH);541 c.lineTo(w * 0.5, h);542 c.lineTo(0, h - isoH);543 c.lineTo(0, isoH);544 c.close();545 c.fillAndStroke();546547 c.setShadow(false);548 549 c.begin();550 c.moveTo(0, isoH);551 c.lineTo(w * 0.5, 2 * isoH);552 c.lineTo(w, isoH);553 c.moveTo(w * 0.5, 2 * isoH);554 c.lineTo(w * 0.5, h);555 c.stroke();556};557558mxCellRenderer.registerShape(mxShapeBasicIsoCube.prototype.cst.ISO_CUBE, mxShapeBasicIsoCube);559560mxShapeBasicIsoCube.prototype.constraints = null;561562Graph.handleFactory[mxShapeBasicIsoCube.prototype.cst.ISO_CUBE] = function(state)563{564 var handles = [Graph.createHandle(state, ['isoAngle'], function(bounds)565 {566 var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.state.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;567 var isoH = Math.min(bounds.width * Math.tan(isoAngle), bounds.height * 0.5);568569 return new mxPoint(bounds.x, bounds.y + isoH);570 }, function(bounds, pt)571 {572 this.state.style['isoAngle'] = Math.round(100 * Math.max(0, Math.min(100, pt.y - bounds.y))) / 100;573 })];574 575 return handles;576};577578mxShapeBasicIsoCube.prototype.getConstraints = function(style, w, h)579{580 var constr = [];581 var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;582 var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);583 584 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));585 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH));586 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));587 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - isoH));588 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));589 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - isoH));590 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));591 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH));592593 return (constr);594}595596//**********************************************************************************************************************************************************597//Acute Triangle598//**********************************************************************************************************************************************************599/**600* Extends mxShape.601*/602function mxShapeBasicTriangleAcute(bounds, fill, stroke, strokewidth)603{604 mxShape.call(this);605 this.bounds = bounds;606 this.fill = fill;607 this.stroke = stroke;608 this.strokewidth = (strokewidth != null) ? strokewidth : 1;609 this.dx = 0.5;610};611612/**613* Extends mxShape.614*/615mxUtils.extend(mxShapeBasicTriangleAcute, mxActor);616617mxShapeBasicTriangleAcute.prototype.customProperties = [618 {name: 'dx', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.5}619];620621mxShapeBasicTriangleAcute.prototype.cst = {ACUTE_TRIANGLE : 'mxgraph.basic.acute_triangle'};622623/**624* Function: paintVertexShape625* 626* Paints the vertex shape.627*/628mxShapeBasicTriangleAcute.prototype.paintVertexShape = function(c, x, y, w, h)629{630 c.translate(x, y);631632 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));633 634 c.begin();635 c.moveTo(0, h);636 c.lineTo(dx, 0);637 c.lineTo(w, h);638 c.close();639 c.fillAndStroke();640};641642mxCellRenderer.registerShape(mxShapeBasicTriangleAcute.prototype.cst.ACUTE_TRIANGLE, mxShapeBasicTriangleAcute);643644mxShapeBasicTriangleAcute.prototype.constraints = null;645646Graph.handleFactory[mxShapeBasicTriangleAcute.prototype.cst.ACUTE_TRIANGLE] = function(state)647{648 var handles = [Graph.createHandle(state, ['dx'], function(bounds)649 {650 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));651652 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 10);653 }, function(bounds, pt)654 {655 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;656 })];657658 return handles;659};660661mxShapeBasicTriangleAcute.prototype.getConstraints = function(style, w, h)662{663 var constr = [];664 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));665 666 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));667 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));668 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));669 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));670 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h * 0.5));671 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - (w - dx) * 0.5, h * 0.5));672673 return (constr);674}675676//**********************************************************************************************************************************************************677//Obtuse Triangle678//**********************************************************************************************************************************************************679/**680* Extends mxShape.681*/682function mxShapeBasicTriangleObtuse(bounds, fill, stroke, strokewidth)683{684 mxShape.call(this);685 this.bounds = bounds;686 this.fill = fill;687 this.stroke = stroke;688 this.strokewidth = (strokewidth != null) ? strokewidth : 1;689 this.dx = 0.5;690};691692/**693* Extends mxShape.694*/695mxUtils.extend(mxShapeBasicTriangleObtuse, mxActor);696697mxShapeBasicTriangleObtuse.prototype.customProperties = [698 {name: 'dx', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.25}699];700701mxShapeBasicTriangleObtuse.prototype.cst = {OBTUSE_TRIANGLE : 'mxgraph.basic.obtuse_triangle'};702703/**704* Function: paintVertexShape705* 706* Paints the vertex shape.707*/708mxShapeBasicTriangleObtuse.prototype.paintVertexShape = function(c, x, y, w, h)709{710 c.translate(x, y);711712 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));713 714 c.begin();715 c.moveTo(dx, h);716 c.lineTo(0, 0);717 c.lineTo(w, h);718 c.close();719 c.fillAndStroke();720};721722mxCellRenderer.registerShape(mxShapeBasicTriangleObtuse.prototype.cst.OBTUSE_TRIANGLE, mxShapeBasicTriangleObtuse);723724mxShapeBasicTriangleObtuse.prototype.constraints = null;725726Graph.handleFactory[mxShapeBasicTriangleObtuse.prototype.cst.OBTUSE_TRIANGLE] = function(state)727{728 var handles = [Graph.createHandle(state, ['dx'], function(bounds)729 {730 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));731732 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + bounds.height - 10);733 }, function(bounds, pt)734 {735 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;736 })];737738 return handles;739};740741mxShapeBasicTriangleObtuse.prototype.getConstraints = function(style, w, h)742{743 var constr = [];744 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));745 746 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));747 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));748 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h * 0.5));749 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx) * 0.5, h));750 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));751 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h * 0.5));752753 return (constr);754}755756//**********************************************************************************************************************************************************757//Drop758//**********************************************************************************************************************************************************759/**760* Extends mxShape.761*/762function mxShapeBasicDrop(bounds, fill, stroke, strokewidth)763{764 mxShape.call(this);765 this.bounds = bounds;766 this.fill = fill;767 this.stroke = stroke;768 this.strokewidth = (strokewidth != null) ? strokewidth : 1;769};770771/**772* Extends mxShape.773*/774mxUtils.extend(mxShapeBasicDrop, mxActor);775776mxShapeBasicDrop.prototype.cst = {DROP : 'mxgraph.basic.drop'};777778/**779* Function: paintVertexShape780* 781* Paints the vertex shape.782*/783mxShapeBasicDrop.prototype.paintVertexShape = function(c, x, y, w, h)784{785 c.translate(x, y);786787 var r = Math.min(h, w) * 0.5;788 var d = h - r;789 var a = Math.sqrt(d * d - r * r);790 791 var angle = Math.atan(a / r);792 793 var x1 = r * Math.sin(angle);794 var y1 = r * Math.cos(angle);795 796 c.begin();797 c.moveTo(w * 0.5, 0);798 c.lineTo(w * 0.5 + x1, h - r - y1);799 c.arcTo(r, r, 0, 0, 1, w * 0.5 + r, h - r);800 c.arcTo(r, r, 0, 0, 1, w * 0.5, h);801 c.arcTo(r, r, 0, 0, 1, w * 0.5 - r, h - r);802 c.arcTo(r, r, 0, 0, 1, w * 0.5 - x1, h - r - y1);803 c.close();804 c.fillAndStroke();805};806807mxCellRenderer.registerShape(mxShapeBasicDrop.prototype.cst.DROP, mxShapeBasicDrop);808809mxShapeBasicDrop.prototype.constraints = null;810811//**********************************************************************************************************************************************************812//Cone 2813//**********************************************************************************************************************************************************814/**815* Extends mxShape.816*/817function mxShapeBasicCone2(bounds, fill, stroke, strokewidth)818{819 mxShape.call(this);820 this.bounds = bounds;821 this.fill = fill;822 this.stroke = stroke;823 this.strokewidth = (strokewidth != null) ? strokewidth : 1;824 this.dx = 0.5;825 this.dy = 0.9;826};827828/**829* Extends mxShape.830*/831mxUtils.extend(mxShapeBasicCone2, mxActor);832833mxShapeBasicCone2.prototype.customProperties = [834 {name: 'dx', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.5},835 {name: 'dy', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.9}836];837838mxShapeBasicCone2.prototype.cst = {CONE2 : 'mxgraph.basic.cone2'};839840/**841* Function: paintVertexShape842* 843* Paints the vertex shape.844*/845mxShapeBasicCone2.prototype.paintVertexShape = function(c, x, y, w, h)846{847 c.translate(x, y);848849 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));850 var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));851 852 var ry = h - dy;853 854 c.begin();855 c.moveTo(dx, 0);856 857 if (ry > 0)858 {859 c.lineTo(w, h - ry);860 c.arcTo(w * 0.5, ry, 0, 0, 1, w * 0.5, h);861 c.arcTo(w * 0.5, ry, 0, 0, 1, 0, h - ry);862 }863 else864 {865 c.lineTo(w, h);866 c.lineTo(0, h);867 }868 869 c.close();870 c.fillAndStroke();871};872873mxCellRenderer.registerShape(mxShapeBasicCone2.prototype.cst.CONE2, mxShapeBasicCone2);874875mxShapeBasicCone2.prototype.constraints = null;876877Graph.handleFactory[mxShapeBasicCone2.prototype.cst.CONE2] = function(state)878{879 var handles = [Graph.createHandle(state, ['dx'], function(bounds)880 {881 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));882883 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 10);884 }, function(bounds, pt)885 {886 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;887 })];888889 var handle2 = Graph.createHandle(state, ['dy'], function(bounds)890 {891 var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));892893 return new mxPoint(bounds.x + 10, bounds.y + dy * bounds.height);894 }, function(bounds, pt)895 {896 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;897 });898 899 handles.push(handle2);900 901 return handles;902};903904mxShapeBasicCone2.prototype.getConstraints = function(style, w, h)905{906 var constr = [];907 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));908 var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));909 var ry = h - dy;910 911 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));912 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - ry));913 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h));914 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - ry));915916 return (constr);917}918919//**********************************************************************************************************************************************************920//Pyramid921//**********************************************************************************************************************************************************922/**923* Extends mxShape.924*/925function mxShapeBasicPyramid(bounds, fill, stroke, strokewidth)926{927 mxShape.call(this);928 this.bounds = bounds;929 this.fill = fill;930 this.stroke = stroke;931 this.strokewidth = (strokewidth != null) ? strokewidth : 1;932 this.dx1 = 0.5;933 this.dx2 = 0.6;934 this.dy1 = 0.9;935 this.dy2 = 0.8;936};937938/**939* Extends mxShape.940*/941mxUtils.extend(mxShapeBasicPyramid, mxActor);942943mxShapeBasicPyramid.prototype.customProperties = [944 {name: 'dx1', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.4},945 {name: 'dx2', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.6},946 {name: 'dy1', dispName: 'Perspective Left', type: 'float', min:0, max:1, defVal:0.9},947 {name: 'dy2', dispName: 'Perspective Right', type: 'float', min:0, max:1, defVal:0.8}948];949950mxShapeBasicPyramid.prototype.cst = {PYRAMID : 'mxgraph.basic.pyramid'};951952/**953* Function: paintVertexShape954* 955* Paints the vertex shape.956*/957mxShapeBasicPyramid.prototype.paintVertexShape = function(c, x, y, w, h)958{959 c.translate(x, y);960961 var dx1 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));962 var dx2 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));963 var dy1 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));964 var dy2 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));965 966 c.begin();967 c.moveTo(dx1, 0);968 c.lineTo(w, dy2);969 c.lineTo(dx2, h);970 c.lineTo(0, dy1);971 c.close();972 c.fillAndStroke();973 974 c.setShadow(false);975 976 c.begin();977 c.moveTo(dx1, 0);978 c.lineTo(dx2, h);979 c.stroke();980};981982mxCellRenderer.registerShape(mxShapeBasicPyramid.prototype.cst.PYRAMID, mxShapeBasicPyramid);983984mxShapeBasicPyramid.prototype.constraints = null;985986Graph.handleFactory[mxShapeBasicPyramid.prototype.cst.PYRAMID] = function(state)987{988 var handles = [Graph.createHandle(state, ['dx1'], function(bounds)989 {990 var dx1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));991992 return new mxPoint(bounds.x + dx1 * bounds.width, bounds.y + 10);993 }, function(bounds, pt)994 {995 this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;996 })];997998 var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)999 {1000 var dx2 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));10011002 return new mxPoint(bounds.x + dx2 * bounds.width, bounds.y + bounds.height - 10);1003 }, function(bounds, pt)1004 {1005 this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;1006 });1007 1008 handles.push(handle2);1009 1010 var handle3 = Graph.createHandle(state, ['dy1'], function(bounds)1011 {1012 var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));10131014 return new mxPoint(bounds.x + 10, bounds.y + dy1 * bounds.height);1015 }, function(bounds, pt)1016 {1017 this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;1018 });1019 1020 handles.push(handle3);1021 1022 var handle4 = Graph.createHandle(state, ['dy2'], function(bounds)1023 {1024 var dy2 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));10251026 return new mxPoint(bounds.x + bounds.width - 10, bounds.y + dy2 * bounds.height);1027 }, function(bounds, pt)1028 {1029 this.state.style['dy2'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;1030 });1031 1032 handles.push(handle4);1033 1034 return handles;1035};10361037mxShapeBasicPyramid.prototype.getConstraints = function(style, w, h)1038{1039 var constr = [];1040 var dx1 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));1041 var dx2 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));1042 var dy1 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));1043 var dy2 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));1044 1045 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx1, 0));1046 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx1) * 0.5, dy2 * 0.5));1047 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy2));1048 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx2) * 0.5, (h + dy2) * 0.5));1049 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h));1050 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 * 0.5, (h + dy1) * 0.5));1051 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy1));1052 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx1 * 0.5, dy1 * 0.5));10531054 return (constr);1055}10561057//**********************************************************************************************************************************************************1058//4 Point Star 21059//**********************************************************************************************************************************************************1060/**1061* Extends mxShape.1062*/1063function mxShapeBasic4PointStar2(bounds, fill, stroke, strokewidth)1064{1065 mxShape.call(this);1066 this.bounds = bounds;1067 this.fill = fill;1068 this.stroke = stroke;1069 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1070 this.dx = 0.8;1071};10721073/**1074* Extends mxShape.1075*/1076mxUtils.extend(mxShapeBasic4PointStar2, mxActor);10771078mxShapeBasic4PointStar2.prototype.customProperties = [1079 {name: 'dx', dispName: 'Thickness', type: 'float', min:0, max:1, defVal:0.8}1080];10811082mxShapeBasic4PointStar2.prototype.cst = {FOUR_POINT_STAR_2 : 'mxgraph.basic.4_point_star_2'};10831084/**1085* Function: paintVertexShape1086* 1087* Paints the vertex shape.1088*/1089mxShapeBasic4PointStar2.prototype.paintVertexShape = function(c, x, y, w, h)1090{1091 c.translate(x, y);10921093 var dx = 0.5 * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));10941095 c.begin();1096 c.moveTo(0, h * 0.5);1097 c.lineTo(dx * w, dx * h);1098 c.lineTo(w * 0.5, 0);1099 c.lineTo(w - dx * w, dx * h);1100 c.lineTo(w, h * 0.5);1101 c.lineTo(w - dx * w, h - dx * h);1102 c.lineTo(w * 0.5, h);1103 c.lineTo(dx * w, h - dx * h);1104 c.close();1105 c.fillAndStroke();1106};11071108mxCellRenderer.registerShape(mxShapeBasic4PointStar2.prototype.cst.FOUR_POINT_STAR_2, mxShapeBasic4PointStar2);11091110mxShapeBasic4PointStar2.prototype.constraints = null;11111112Graph.handleFactory[mxShapeBasic4PointStar2.prototype.cst.FOUR_POINT_STAR_2] = function(state)1113{1114 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1115 {1116 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));11171118 return new mxPoint(bounds.x + dx * bounds.width / 2, bounds.y + dx * bounds.height / 2);1119 }, function(bounds, pt)1120 {1121 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, 2 * (pt.x - bounds.x) / bounds.width))) / 100;1122 })];11231124 return handles;1125};11261127mxShapeBasic4PointStar2.prototype.getConstraints = function(style, w, h)1128{1129 var constr = [];1130 var dx = 0.5 * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));11311132 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1133 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1134 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1135 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1136 constr.push(new mxConnectionConstraint(new mxPoint(dx, dx), false));1137 constr.push(new mxConnectionConstraint(new mxPoint(1 - dx, dx), false));1138 constr.push(new mxConnectionConstraint(new mxPoint(1 - dx, 1 - dx), false));1139 constr.push(new mxConnectionConstraint(new mxPoint(dx, 1 - dx), false));11401141 return (constr);1142}11431144//**********************************************************************************************************************************************************1145//Diagonal Snip Rectangle1146//**********************************************************************************************************************************************************1147/**1148* Extends mxShape.1149*/1150function mxShapeBasicDiagSnipRect(bounds, fill, stroke, strokewidth)1151{1152 mxShape.call(this);1153 this.bounds = bounds;1154 this.fill = fill;1155 this.stroke = stroke;1156 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1157 this.dx = 0.5;1158};11591160/**1161* Extends mxShape.1162*/1163mxUtils.extend(mxShapeBasicDiagSnipRect, mxActor);11641165mxShapeBasicDiagSnipRect.prototype.customProperties = [1166 {name: 'dx', dispName: 'Snip', type: 'float', min:0, deVal:6},1167];11681169mxShapeBasicDiagSnipRect.prototype.cst = {DIAG_SNIP_RECT : 'mxgraph.basic.diag_snip_rect'};11701171/**1172* Function: paintVertexShape1173* 1174* Paints the vertex shape.1175*/1176mxShapeBasicDiagSnipRect.prototype.paintVertexShape = function(c, x, y, w, h)1177{1178 c.translate(x, y);11791180 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;11811182 dx = Math.min(w * 0.5, h * 0.5, dx);1183 1184 c.begin();1185 c.moveTo(dx, 0);1186 c.lineTo(w, 0);1187 c.lineTo(w, h - dx);1188 c.lineTo(w - dx, h);1189 c.lineTo(0, h);1190 c.lineTo(0, dx);1191 c.close();1192 c.fillAndStroke();1193};11941195mxCellRenderer.registerShape(mxShapeBasicDiagSnipRect.prototype.cst.DIAG_SNIP_RECT, mxShapeBasicDiagSnipRect);11961197mxShapeBasicDiagSnipRect.prototype.constraints = null;11981199Graph.handleFactory[mxShapeBasicDiagSnipRect.prototype.cst.DIAG_SNIP_RECT] = function(state)1200{1201 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1202 {1203 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));12041205 return new mxPoint(bounds.x + dx, bounds.y + dx);1206 }, function(bounds, pt)1207 {1208 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1209 })];1210 1211 return handles;1212};12131214mxShapeBasicDiagSnipRect.prototype.getConstraints = function(style, w, h)1215{1216 var constr = [];1217 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;12181219 dx = Math.min(w * 0.5, h * 0.5, dx) * 0.5;12201221 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));1222 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1223 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1224 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1225 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dx));1226 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1227 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1228 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));12291230 return (constr);1231}12321233//**********************************************************************************************************************************************************1234//Diagonal Round Rectangle1235//**********************************************************************************************************************************************************1236/**1237* Extends mxShape.1238*/1239function mxShapeBasicDiagRoundRect(bounds, fill, stroke, strokewidth)1240{1241 mxShape.call(this);1242 this.bounds = bounds;1243 this.fill = fill;1244 this.stroke = stroke;1245 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1246 this.dx = 0.5;1247};12481249/**1250* Extends mxShape.1251*/1252mxUtils.extend(mxShapeBasicDiagRoundRect, mxActor);12531254mxShapeBasicDiagRoundRect.prototype.customProperties = [1255 {name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6},1256];12571258mxShapeBasicDiagRoundRect.prototype.cst = {DIAG_ROUND_RECT : 'mxgraph.basic.diag_round_rect'};12591260/**1261* Function: paintVertexShape1262* 1263* Paints the vertex shape.1264*/1265mxShapeBasicDiagRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)1266{1267 c.translate(x, y);12681269 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;12701271 dx = Math.min(w * 0.5, h * 0.5, dx);1272 1273 c.begin();1274 c.moveTo(dx, 0);1275 c.lineTo(w, 0);1276 c.lineTo(w, h - dx);1277 c.arcTo(dx, dx, 0, 0, 1, w - dx, h);1278 c.lineTo(0, h);1279 c.lineTo(0, dx);1280 c.arcTo(dx, dx, 0, 0, 1, dx, 0);1281 c.close();1282 c.fillAndStroke();1283};12841285mxCellRenderer.registerShape(mxShapeBasicDiagRoundRect.prototype.cst.DIAG_ROUND_RECT, mxShapeBasicDiagRoundRect);12861287mxShapeBasicDiagRoundRect.prototype.constraints = null;12881289Graph.handleFactory[mxShapeBasicDiagRoundRect.prototype.cst.DIAG_ROUND_RECT] = function(state)1290{1291 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1292 {1293 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));12941295 return new mxPoint(bounds.x + dx, bounds.y + dx);1296 }, function(bounds, pt)1297 {1298 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1299 })];1300 1301 return handles;1302};13031304mxShapeBasicDiagRoundRect.prototype.getConstraints = function(style, w, h)1305{1306 var constr = [];13071308 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1309 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1310 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1311 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1312 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1313 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));13141315 return (constr);1316}13171318//**********************************************************************************************************************************************************1319//Corner Round Rectangle1320//**********************************************************************************************************************************************************1321/**1322* Extends mxShape.1323*/1324function mxShapeBasicCornerRoundRect(bounds, fill, stroke, strokewidth)1325{1326 mxShape.call(this);1327 this.bounds = bounds;1328 this.fill = fill;1329 this.stroke = stroke;1330 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1331 this.dx = 0.5;1332};13331334/**1335* Extends mxShape.1336*/1337mxUtils.extend(mxShapeBasicCornerRoundRect, mxActor);13381339mxShapeBasicCornerRoundRect.prototype.customProperties = [1340 {name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6},1341];13421343mxShapeBasicCornerRoundRect.prototype.cst = {CORNER_ROUND_RECT : 'mxgraph.basic.corner_round_rect'};13441345/**1346* Function: paintVertexShape1347* 1348* Paints the vertex shape.1349*/1350mxShapeBasicCornerRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)1351{1352 c.translate(x, y);13531354 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;13551356 dx = Math.min(w * 0.5, h * 0.5, dx);1357 1358 c.begin();1359 c.moveTo(dx, 0);1360 c.lineTo(w, 0);1361 c.lineTo(w, h);1362 c.lineTo(0, h);1363 c.lineTo(0, dx);1364 c.arcTo(dx, dx, 0, 0, 1, dx, 0);1365 c.close();1366 c.fillAndStroke();1367};13681369mxCellRenderer.registerShape(mxShapeBasicCornerRoundRect.prototype.cst.CORNER_ROUND_RECT, mxShapeBasicCornerRoundRect);13701371mxShapeBasicCornerRoundRect.prototype.constraints = null;13721373Graph.handleFactory[mxShapeBasicCornerRoundRect.prototype.cst.CORNER_ROUND_RECT] = function(state)1374{1375 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1376 {1377 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));13781379 return new mxPoint(bounds.x + dx, bounds.y + dx);1380 }, function(bounds, pt)1381 {1382 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1383 })];1384 1385 return handles;1386};13871388mxShapeBasicCornerRoundRect.prototype.getConstraints = function(style, w, h)1389{1390 var constr = [];13911392 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1393 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1394 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1395 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));1396 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1397 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1398 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));13991400 return (constr);1401}14021403//**********************************************************************************************************************************************************1404//Plaque1405//**********************************************************************************************************************************************************1406/**1407* Extends mxShape.1408*/1409function mxShapeBasicPlaque(bounds, fill, stroke, strokewidth)1410{1411 mxShape.call(this);1412 this.bounds = bounds;1413 this.fill = fill;1414 this.stroke = stroke;1415 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1416 this.dx = 0.5;1417};14181419/**1420* Extends mxShape.1421*/1422mxUtils.extend(mxShapeBasicPlaque, mxActor);14231424mxShapeBasicPlaque.prototype.customProperties = [1425 {name: 'dx', dispName: 'Cutoff Size', type: 'float', min:0, defVal:6},1426];14271428mxShapeBasicPlaque.prototype.cst = {PLAQUE : 'mxgraph.basic.plaque'};14291430/**1431* Function: paintVertexShape1432* 1433* Paints the vertex shape.1434*/1435mxShapeBasicPlaque.prototype.paintVertexShape = function(c, x, y, w, h)1436{1437 c.translate(x, y);14381439 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;14401441 dx = Math.min(w * 0.5, h * 0.5, dx);1442 1443 c.begin();1444 c.moveTo(w - dx, 0);1445 c.arcTo(dx, dx, 0, 0, 0, w, dx);1446 c.lineTo(w, h - dx);1447 c.arcTo(dx, dx, 0, 0, 0, w - dx, h);1448 c.lineTo(dx, h);1449 c.arcTo(dx, dx, 0, 0, 0, 0, h - dx);1450 c.lineTo(0, dx);1451 c.arcTo(dx, dx, 0, 0, 0, dx, 0);1452 c.close();1453 c.fillAndStroke();1454};14551456mxCellRenderer.registerShape(mxShapeBasicPlaque.prototype.cst.PLAQUE, mxShapeBasicPlaque);14571458mxShapeBasicPlaque.prototype.constraints = null;14591460Graph.handleFactory[mxShapeBasicPlaque.prototype.cst.PLAQUE] = function(state)1461{1462 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1463 {1464 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));14651466 return new mxPoint(bounds.x + dx * 1.41, bounds.y + dx * 1.41);1467 }, function(bounds, pt)1468 {1469 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1470 })];1471 1472 return handles;1473};14741475mxShapeBasicPlaque.prototype.getConstraints = function(style, w, h)1476{1477 var constr = [];14781479 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1480 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1481 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1482 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));14831484 return (constr);1485}14861487//**********************************************************************************************************************************************************1488//Frame1489//**********************************************************************************************************************************************************1490/**1491* Extends mxShape.1492*/1493function mxShapeBasicFrame(bounds, fill, stroke, strokewidth)1494{1495 mxShape.call(this);1496 this.bounds = bounds;1497 this.fill = fill;1498 this.stroke = stroke;1499 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1500 this.dx = 0.5;1501};15021503/**1504* Extends mxShape.1505*/1506mxUtils.extend(mxShapeBasicFrame, mxActor);15071508mxShapeBasicFrame.prototype.customProperties = [1509 {name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},1510];15111512mxShapeBasicFrame.prototype.cst = {FRAME : 'mxgraph.basic.frame'};15131514/**1515* Function: paintVertexShape1516* 1517* Paints the vertex shape.1518*/1519mxShapeBasicFrame.prototype.paintVertexShape = function(c, x, y, w, h)1520{1521 c.translate(x, y);15221523 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));15241525 dx = Math.min(w * 0.5, h * 0.5, dx);1526 1527 c.begin();1528 c.moveTo(w, 0);1529 c.lineTo(w, h);1530 c.lineTo(0, h);1531 c.lineTo(0, 0);1532 c.close();1533 c.moveTo(dx, dx);1534 c.lineTo(dx, h - dx);1535 c.lineTo(w - dx, h - dx);1536 c.lineTo(w - dx, dx);1537 c.close();1538 c.fillAndStroke();1539};15401541mxCellRenderer.registerShape(mxShapeBasicFrame.prototype.cst.FRAME, mxShapeBasicFrame);15421543mxShapeBasicFrame.prototype.constraints = null;15441545Graph.handleFactory[mxShapeBasicFrame.prototype.cst.FRAME] = function(state)1546{1547 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1548 {1549 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));15501551 return new mxPoint(bounds.x + dx, bounds.y + dx);1552 }, function(bounds, pt)1553 {1554 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;1555 })];1556 1557 return handles;1558};15591560mxShapeBasicFrame.prototype.getConstraints = function(style, w, h)1561{1562 var constr = [];1563 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1564 dx = Math.min(w * 0.5, h * 0.5, dx);15651566 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));1567 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, 0));1568 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1569 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, 0));1570 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1571 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.25));1572 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1573 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.75));1574 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));1575 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h));1576 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1577 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h));1578 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1579 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.75));1580 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1581 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.25));1582 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));1583 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx)* 0.25 + dx, dx));1584 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));1585 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx) * 0.5, dx));1586 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -dx, dx));1587 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, (h - 2 * dx)* 0.25 + dx));1588 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));1589 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, (h - 2 * dx) * 0.75 + dx));1590 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -dx, -dx));1591 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx) * 0.75 + dx, h - dx));1592 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));1593 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx) * 0.25 + dx, h - dx));1594 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, dx, -dx));1595 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.75 + dx));1596 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));1597 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.25 + dx));15981599 return (constr);1600}16011602//**********************************************************************************************************************************************************1603//Plaque Frame1604//**********************************************************************************************************************************************************1605/**1606* Extends mxShape.1607*/1608function mxShapeBasicPlaqueFrame(bounds, fill, stroke, strokewidth)1609{1610 mxShape.call(this);1611 this.bounds = bounds;1612 this.fill = fill;1613 this.stroke = stroke;1614 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1615 this.dx = 0.5;1616};16171618/**1619*/1620mxUtils.extend(mxShapeBasicPlaqueFrame, mxActor);16211622mxShapeBasicPlaqueFrame.prototype.customProperties = [1623 {name: 'dx', dispName: 'Width', type: 'float', mix:0, defVal:10},1624];16251626mxShapeBasicPlaqueFrame.prototype.cst = {PLAQUE_FRAME : 'mxgraph.basic.plaque_frame'};16271628/**1629* Function: paintVertexShape1630* 1631* Paints the vertex shape.1632*/1633mxShapeBasicPlaqueFrame.prototype.paintVertexShape = function(c, x, y, w, h)1634{1635 c.translate(x, y);16361637 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));16381639 dx = Math.min(w * 0.25, h * 0.25, dx);1640 1641 c.begin();1642 c.moveTo(w - dx, 0);1643 c.arcTo(dx, dx, 0, 0, 0, w, dx);1644 c.lineTo(w, h - dx);1645 c.arcTo(dx, dx, 0, 0, 0, w - dx, h);1646 c.lineTo(dx, h);1647 c.arcTo(dx, dx, 0, 0, 0, 0, h - dx);1648 c.lineTo(0, dx);1649 c.arcTo(dx, dx, 0, 0, 0, dx, 0);1650 c.close();1651 1652 c.moveTo(dx * 2, dx);1653 c.arcTo(dx * 2, dx * 2, 0, 0, 1, dx, dx * 2);1654 c.lineTo(dx, h - 2 * dx);1655 c.arcTo(dx * 2, dx * 2, 0, 0, 1, dx * 2, h - dx);1656 c.lineTo(w - 2 * dx, h - dx);1657 c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - dx, h - 2 * dx);1658 c.lineTo(w - dx, dx * 2);1659 c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - 2 * dx, dx);1660 c.close();16611662 c.fillAndStroke();16631664};16651666mxCellRenderer.registerShape(mxShapeBasicPlaqueFrame.prototype.cst.PLAQUE_FRAME, mxShapeBasicPlaqueFrame);16671668mxShapeBasicPlaqueFrame.prototype.constraints = null;16691670Graph.handleFactory[mxShapeBasicPlaqueFrame.prototype.cst.PLAQUE_FRAME] = function(state)1671{1672 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1673 {1674 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));16751676 return new mxPoint(bounds.x + dx, bounds.y + dx);1677 }, function(bounds, pt)1678 {1679 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1680 })];1681 1682 return handles;1683};16841685mxShapeBasicPlaqueFrame.prototype.getConstraints = function(style, w, h)1686{1687 var constr = [];1688 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1689 dx = Math.min(w * 0.5, h * 0.5, dx);16901691 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1692 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1693 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1694 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1695 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));1696 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));1697 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));1698 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));16991700 return (constr);1701}17021703//**********************************************************************************************************************************************************1704//Rounded Frame1705//**********************************************************************************************************************************************************1706/**1707* Extends mxShape.1708*/1709function mxShapeBasicRoundedFrame(bounds, fill, stroke, strokewidth)1710{1711 mxShape.call(this);1712 this.bounds = bounds;1713 this.fill = fill;1714 this.stroke = stroke;1715 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1716 this.dx = 0.5;1717};17181719/**1720* Extends mxShape.1721*/1722mxUtils.extend(mxShapeBasicRoundedFrame, mxActor);17231724mxShapeBasicRoundedFrame.prototype.customProperties = [1725 {name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},1726];17271728mxShapeBasicRoundedFrame.prototype.cst = {ROUNDED_FRAME : 'mxgraph.basic.rounded_frame'};17291730/**1731* Function: paintVertexShape1732* 1733* Paints the vertex shape.1734*/1735mxShapeBasicRoundedFrame.prototype.paintVertexShape = function(c, x, y, w, h)1736{1737 c.translate(x, y);17381739 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));17401741 dx = Math.min(w * 0.25, h * 0.25, dx);1742 1743 c.begin();1744 c.moveTo(w - 2 * dx, 0);1745 c.arcTo(dx * 2, dx * 2, 0, 0, 1, w, 2 * dx);1746 c.lineTo(w, h - 2 * dx);1747 c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - 2 * dx, h);1748 c.lineTo(dx * 2, h);1749 c.arcTo(dx * 2, dx * 2, 0, 0, 1, 0, h - 2 * dx);1750 c.lineTo(0, 2 * dx);1751 c.arcTo(dx * 2, dx * 2, 0, 0, 1, 2 * dx, 0);1752 c.close();1753 1754 c.moveTo(dx * 2, dx);1755 c.arcTo(dx, dx, 0, 0, 0, dx, dx * 2);1756 c.lineTo(dx, h - 2 * dx);1757 c.arcTo(dx, dx, 0, 0, 0, dx * 2, h - dx);1758 c.lineTo(w - 2 * dx, h - dx);1759 c.arcTo(dx, dx, 0, 0, 0, w - dx, h - 2 * dx);1760 c.lineTo(w - dx, dx * 2);1761 c.arcTo(dx, dx, 0, 0, 0, w - 2 * dx, dx);1762 c.close();17631764 c.fillAndStroke();17651766};17671768mxCellRenderer.registerShape(mxShapeBasicRoundedFrame.prototype.cst.ROUNDED_FRAME, mxShapeBasicRoundedFrame);17691770mxShapeBasicRoundedFrame.prototype.constraints = null;17711772Graph.handleFactory[mxShapeBasicRoundedFrame.prototype.cst.ROUNDED_FRAME] = function(state)1773{1774 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1775 {1776 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));17771778 return new mxPoint(bounds.x + dx, bounds.y + dx);1779 }, function(bounds, pt)1780 {1781 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;1782 })];1783 1784 return handles;1785};17861787mxShapeBasicRoundedFrame.prototype.getConstraints = function(style, w, h)1788{1789 var constr = [];1790 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1791 dx = Math.min(w * 0.5, h * 0.5, dx);17921793 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1794 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1795 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1796 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1797 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));1798 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));1799 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));1800 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));18011802 return (constr);1803}18041805//**********************************************************************************************************************************************************1806//Frame Corner1807//**********************************************************************************************************************************************************1808/**1809* Extends mxShape.1810*/1811function mxShapeBasicFrameCorner(bounds, fill, stroke, strokewidth)1812{1813 mxShape.call(this);1814 this.bounds = bounds;1815 this.fill = fill;1816 this.stroke = stroke;1817 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1818 this.dx = 0.5;1819};18201821/**1822* Extends mxShape.1823*/1824mxUtils.extend(mxShapeBasicFrameCorner, mxActor);18251826mxShapeBasicFrameCorner.prototype.customProperties = [1827 {name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},1828];18291830mxShapeBasicFrameCorner.prototype.cst = {FRAME_CORNER : 'mxgraph.basic.frame_corner'};18311832/**1833* Function: paintVertexShape1834* 1835* Paints the vertex shape.1836*/1837mxShapeBasicFrameCorner.prototype.paintVertexShape = function(c, x, y, w, h)1838{1839 c.translate(x, y);18401841 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));18421843 dx = Math.min(w * 0.5, h * 0.5, dx);1844 1845 c.begin();1846 c.moveTo(0, 0);1847 c.lineTo(w, 0);1848 c.lineTo(w - dx, dx);1849 c.lineTo(dx, dx);1850 c.lineTo(dx, h - dx);1851 c.lineTo(0, h);1852 c.close();1853 c.fillAndStroke();1854};18551856mxCellRenderer.registerShape(mxShapeBasicFrameCorner.prototype.cst.FRAME_CORNER, mxShapeBasicFrameCorner);18571858mxShapeBasicFrameCorner.prototype.constraints = null;18591860Graph.handleFactory[mxShapeBasicFrameCorner.prototype.cst.FRAME_CORNER] = function(state)1861{1862 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1863 {1864 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));18651866 return new mxPoint(bounds.x + dx, bounds.y + dx);1867 }, function(bounds, pt)1868 {1869 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;1870 })];1871 1872 return handles;1873};18741875mxShapeBasicFrameCorner.prototype.getConstraints = function(style, w, h)1876{1877 var constr = [];1878 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));18791880 dx = Math.min(w * 0.5, h * 0.5, dx);1881 1882 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));1883 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1884 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1885 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -dx, dx));1886 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx) * 0.5 + dx, dx));1887 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));1888 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.5 + dx));1889 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, dx, -dx));1890 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1891 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));18921893 return (constr);1894}18951896//**********************************************************************************************************************************************************1897//Diagonal Stripe1898//**********************************************************************************************************************************************************1899/**1900* Extends mxShape.1901*/1902function mxShapeBasicDiagStripe(bounds, fill, stroke, strokewidth)1903{1904 mxShape.call(this);1905 this.bounds = bounds;1906 this.fill = fill;1907 this.stroke = stroke;1908 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1909 this.dx = 0.5;1910};19111912/**1913* Extends mxShape.1914*/1915mxUtils.extend(mxShapeBasicDiagStripe, mxActor);19161917mxShapeBasicDiagStripe.prototype.customProperties = [1918 {name: 'dx', dispName: 'Width', type: 'float', mix:0, defVal:10},1919];19201921mxShapeBasicDiagStripe.prototype.cst = {DIAG_STRIPE : 'mxgraph.basic.diag_stripe'};19221923/**1924* Function: paintVertexShape1925* 1926* Paints the vertex shape.1927*/1928mxShapeBasicDiagStripe.prototype.paintVertexShape = function(c, x, y, w, h)1929{1930 c.translate(x, y);19311932 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));19331934 dx = Math.min(w, h, dx);1935 1936 c.begin();1937 c.moveTo(0, h);1938 c.lineTo(w, 0);1939 c.lineTo(w, Math.min(dx * 100 / w, h));1940 c.lineTo(Math.min(dx * 100 / h, w), h);1941 c.close();1942 c.fillAndStroke();1943};19441945mxCellRenderer.registerShape(mxShapeBasicDiagStripe.prototype.cst.DIAG_STRIPE, mxShapeBasicDiagStripe);19461947mxShapeBasicDiagStripe.prototype.constraints = null;19481949Graph.handleFactory[mxShapeBasicDiagStripe.prototype.cst.DIAG_STRIPE] = function(state)1950{1951 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1952 {1953 var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));19541955 return new mxPoint(bounds.x + dx, bounds.y + bounds.height);1956 }, function(bounds, pt)1957 {1958 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;1959 })];1960 1961 return handles;1962};19631964mxShapeBasicDiagStripe.prototype.getConstraints = function(style, w, h)1965{1966 var constr = [];1967 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1968 dx = Math.min(w, h, dx);1969 1970 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));1971 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.5), false));1972 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1973 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, Math.min(dx * 100 / w, h) * 0.5));1974 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, Math.min(dx * 100 / w, h)));1975 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + Math.min(dx * 100 / h, w)) * 0.5, (Math.min(dx * 100 / w, h) + h) * 0.5));1976 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.min(dx * 100 / h, w), h));1977 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.min(dx * 100 / h, w) * 0.5, h));19781979 return (constr);1980}19811982//**********************************************************************************************************************************************************1983//Donut1984//**********************************************************************************************************************************************************1985/**1986* Extends mxShape.1987*/1988function mxShapeBasicDonut(bounds, fill, stroke, strokewidth)1989{1990 mxShape.call(this);1991 this.bounds = bounds;1992 this.fill = fill;1993 this.stroke = stroke;1994 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1995 this.dx = 0.5;1996};19971998/**1999* Extends mxShape.2000*/2001mxUtils.extend(mxShapeBasicDonut, mxActor);20022003mxShapeBasicDonut.prototype.customProperties = [2004 {name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:25}2005];20062007mxShapeBasicDonut.prototype.cst = {DONUT : 'mxgraph.basic.donut'};20082009/**2010* Function: paintVertexShape2011* 2012* Paints the vertex shape.2013*/2014mxShapeBasicDonut.prototype.paintVertexShape = function(c, x, y, w, h)2015{2016 c.translate(x, y);20172018 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));20192020 dx = Math.min(w * 0.5, h * 0.5, dx);2021 2022 c.begin();2023 c.moveTo(0, h * 0.5);2024 c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, 0);2025 c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w, h * 0.5);2026 c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, h);2027 c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, 0, h * 0.5);2028 c.close();2029 c.moveTo(w * 0.5, dx);2030 c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, dx, h * 0.5);2031 c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w * 0.5, h - dx);2032 c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w - dx, h * 0.5);2033 c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w * 0.5, dx);2034 c.close();2035 c.fillAndStroke();2036};20372038mxCellRenderer.registerShape(mxShapeBasicDonut.prototype.cst.DONUT, mxShapeBasicDonut);20392040mxShapeBasicDonut.prototype.constraints = null;20412042Graph.handleFactory[mxShapeBasicDonut.prototype.cst.DONUT] = function(state)2043{2044 var handles = [Graph.createHandle(state, ['dx'], function(bounds)2045 {2046 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));20472048 return new mxPoint(bounds.x + dx, bounds.y + bounds.height / 2);2049 }, function(bounds, pt)2050 {2051 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;2052 })];2053 2054 return handles;2055};20562057//**********************************************************************************************************************************************************2058//Layered Rect2059//**********************************************************************************************************************************************************2060/**2061* Extends mxShape.2062*/2063function mxShapeBasicLayeredRect(bounds, fill, stroke, strokewidth)2064{2065 mxShape.call(this);2066 this.bounds = bounds;2067 this.fill = fill;2068 this.stroke = stroke;2069 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2070 this.dx = 0.5;2071};20722073/**2074* Extends mxShape.2075*/2076mxUtils.extend(mxShapeBasicLayeredRect, mxActor);20772078mxShapeBasicLayeredRect.prototype.customProperties = [2079 {name: 'dx', dispName: 'Layer Distance', type: 'float', mix:0, defVal:10}2080];20812082mxShapeBasicLayeredRect.prototype.cst = {LAYERED_RECT : 'mxgraph.basic.layered_rect'};20832084/**2085* Function: paintVertexShape2086* 2087* Paints the vertex shape.2088*/2089mxShapeBasicLayeredRect.prototype.paintVertexShape = function(c, x, y, w, h)2090{2091 c.translate(x, y);20922093 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));20942095 dx = Math.min(w * 0.5, h * 0.5, dx);2096 2097 c.begin();2098 c.moveTo(dx, dx);2099 c.lineTo(w, dx);2100 c.lineTo(w, h);2101 c.lineTo(dx, h);2102 c.close();2103 c.fillAndStroke();2104 2105 c.begin();2106 c.moveTo(dx * 0.5, dx * 0.5);2107 c.lineTo(w - dx * 0.5, dx * 0.5);2108 c.lineTo(w - dx * 0.5, h - dx * 0.5);2109 c.lineTo(dx * 0.5, h - dx * 0.5);2110 c.close();2111 c.fillAndStroke();2112 2113 c.begin();2114 c.moveTo(0, 0);2115 c.lineTo(w - dx, 0);2116 c.lineTo(w - dx, h - dx);2117 c.lineTo(0, h - dx);2118 c.close();2119 c.fillAndStroke();2120};21212122mxCellRenderer.registerShape(mxShapeBasicLayeredRect.prototype.cst.LAYERED_RECT, mxShapeBasicLayeredRect);21232124mxShapeBasicLayeredRect.prototype.constraints = null;21252126Graph.handleFactory[mxShapeBasicLayeredRect.prototype.cst.LAYERED_RECT] = function(state)2127{2128 var handles = [Graph.createHandle(state, ['dx'], function(bounds)2129 {2130 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));21312132 return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - dx);2133 }, function(bounds, pt)2134 {2135 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, - pt.x + bounds.width + bounds.x))) / 100;2136 })];2137 2138 return handles;2139};21402141mxShapeBasicLayeredRect.prototype.getConstraints = function(style, w, h)2142{2143 var constr = [];2144 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));2145 dx = Math.min(w * 0.5, h * 0.5, dx);2146 2147 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));2148 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.25, 0));2149 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, 0));2150 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.75, 0));2151 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));2152 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.5, dx * 0.5));2153 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx));2154 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.25 + dx));2155 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.5 + dx));2156 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.75 + dx));2157 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h));2158 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.75 + dx, h));2159 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5 + dx, h));2160 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.25 + dx, h));2161 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));2162 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h - dx * 0.5));2163 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dx));2164 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.75));2165 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.5));2166 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.25));21672168 return (constr);2169}21702171//**********************************************************************************************************************************************************2172//Button2173//**********************************************************************************************************************************************************2174/**2175* Extends mxShape.2176*/2177function mxShapeBasicButton(bounds, fill, stroke, strokewidth)2178{2179 mxShape.call(this);2180 this.bounds = bounds;2181 this.fill = fill;2182 this.stroke = stroke;2183 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2184 this.dx = 0.5;2185};21862187/**2188* Extends mxShape.2189*/2190mxUtils.extend(mxShapeBasicButton, mxActor);21912192mxShapeBasicButton.prototype.customProperties = [2193 {name: 'dx', dispName: 'Button Height', type: 'float', min:0, defVal:10}2194];21952196mxShapeBasicButton.prototype.cst = {BUTTON : 'mxgraph.basic.button'};21972198/**2199* Function: paintVertexShape2200* 2201* Paints the vertex shape.2202*/2203mxShapeBasicButton.prototype.paintVertexShape = function(c, x, y, w, h)2204{2205 c.translate(x, y);22062207 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));22082209 dx = Math.min(w * 0.5, h * 0.5, dx);2210 2211 c.begin();2212 c.moveTo(0, 0);2213 c.lineTo(w, 0);2214 c.lineTo(w, h);2215 c.lineTo(0, h);2216 c.close();2217 c.fillAndStroke();2218 2219 c.setShadow(false);2220 c.setLineJoin('round');2221 2222 c.begin();2223 c.moveTo(0, h);2224 c.lineTo(0, 0);2225 c.lineTo(dx, dx);2226 c.lineTo(dx, h - dx);2227 c.close();2228 c.fillAndStroke();2229 2230 c.begin();2231 c.moveTo(0, 0);2232 c.lineTo(w, 0);2233 c.lineTo(w - dx, dx);2234 c.lineTo(dx, dx);2235 c.close();2236 c.fillAndStroke();2237 2238 c.begin();2239 c.moveTo(w, 0);2240 c.lineTo(w, h);2241 c.lineTo(w - dx, h - dx);2242 c.lineTo(w - dx, dx);2243 c.close();2244 c.fillAndStroke();2245 2246 c.begin();2247 c.moveTo(0, h);2248 c.lineTo(dx, h - dx);2249 c.lineTo(w - dx, h - dx);2250 c.lineTo(w, h);2251 c.close();2252 c.fillAndStroke();2253 2254 c.begin();2255 c.moveTo(0, h);2256 c.lineTo(0, 0);2257 c.lineTo(dx, dx);2258 c.lineTo(dx, h - dx);2259 c.close();2260 c.fillAndStroke();2261 2262 2263};22642265mxCellRenderer.registerShape(mxShapeBasicButton.prototype.cst.BUTTON, mxShapeBasicButton);22662267mxShapeBasicButton.prototype.constraints = null;22682269Graph.handleFactory[mxShapeBasicButton.prototype.cst.BUTTON] = function(state)2270{2271 var handles = [Graph.createHandle(state, ['dx'], function(bounds)2272 {2273 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));22742275 return new mxPoint(bounds.x + dx, bounds.y + dx);2276 }, function(bounds, pt)2277 {2278 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;2279 })];2280 2281 return handles;2282};22832284//**********************************************************************************************************************************************************2285//Shaded Button2286//**********************************************************************************************************************************************************2287/**2288* Extends mxShape.2289*/2290function mxShapeBasicShadedButton(bounds, fill, stroke, strokewidth)2291{2292 mxShape.call(this);2293 this.bounds = bounds;2294 this.fill = fill;2295 this.stroke = stroke;2296 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2297 this.dx = 0.5;2298};22992300/**2301* Extends mxShape.2302*/2303mxUtils.extend(mxShapeBasicShadedButton, mxActor);23042305mxShapeBasicShadedButton.prototype.customProperties = [2306 {name: 'dx', dispName: 'Button Height', type: 'float', min:0, defVal:10}2307];23082309mxShapeBasicShadedButton.prototype.cst = {SHADED_BUTTON : 'mxgraph.basic.shaded_button'};23102311/**2312* Function: paintVertexShape2313* 2314* Paints the vertex shape.2315*/2316mxShapeBasicShadedButton.prototype.paintVertexShape = function(c, x, y, w, h)2317{2318 c.translate(x, y);2319 2320 c.setShadow(false);23212322 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));23232324 dx = Math.min(w * 0.5, h * 0.5, dx);2325 2326 c.begin();2327 c.moveTo(0, 0);2328 c.lineTo(w, 0);2329 c.lineTo(w, h);2330 c.lineTo(0, h);2331 c.close();2332 c.fill();2333 2334 c.setFillColor('#ffffff');2335 c.setAlpha(0.25);2336 c.begin();2337 c.moveTo(0, h);2338 c.lineTo(0, 0);2339 c.lineTo(dx, dx);2340 c.lineTo(dx, h - dx);2341 c.close();2342 c.fill();2343 2344 c.setAlpha(0.5);2345 c.begin();2346 c.moveTo(0, 0);2347 c.lineTo(w, 0);2348 c.lineTo(w - dx, dx);2349 c.lineTo(dx, dx);2350 c.close();2351 c.fill();2352 2353 c.setFillColor('#000000');2354 c.setAlpha(0.25);2355 c.begin();2356 c.moveTo(w, 0);2357 c.lineTo(w, h);2358 c.lineTo(w - dx, h - dx);2359 c.lineTo(w - dx, dx);2360 c.close();2361 c.fill();2362 2363 c.setAlpha(0.5);2364 c.begin();2365 c.moveTo(0, h);2366 c.lineTo(dx, h - dx);2367 c.lineTo(w - dx, h - dx);2368 c.lineTo(w, h);2369 c.close();2370 c.fill();2371 2372 2373};23742375mxCellRenderer.registerShape(mxShapeBasicShadedButton.prototype.cst.SHADED_BUTTON, mxShapeBasicShadedButton);23762377mxShapeBasicShadedButton.prototype.constraints = null;23782379Graph.handleFactory[mxShapeBasicShadedButton.prototype.cst.SHADED_BUTTON] = function(state)2380{2381 var handles = [Graph.createHandle(state, ['dx'], function(bounds)2382 {2383 var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));23842385 return new mxPoint(bounds.x + dx, bounds.y + dx);2386 }, function(bounds, pt)2387 {2388 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;2389 })];2390 2391 return handles;2392};23932394//**********************************************************************************************************************************************************2395//Pie2396//**********************************************************************************************************************************************************2397/**2398* Extends mxShape.2399*/2400function mxShapeBasicPie(bounds, fill, stroke, strokewidth)2401{2402 mxShape.call(this);2403 this.bounds = bounds;2404 this.fill = fill;2405 this.stroke = stroke;2406 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2407 this.startAngle = 0.25;2408 this.endAngle = 0.75;2409};24102411/**2412* Extends mxShape.2413*/2414mxUtils.extend(mxShapeBasicPie, mxActor);24152416mxShapeBasicPie.prototype.customProperties = [2417 {name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal: 0.2},2418 {name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal: 0.9}2419];24202421mxShapeBasicPie.prototype.cst = {PIE : 'mxgraph.basic.pie'};24222423/**2424* Function: paintVertexShape2425* 2426* Paints the vertex shape.2427*/2428mxShapeBasicPie.prototype.paintVertexShape = function(c, x, y, w, h)2429{2430 c.translate(x, y);2431 var startAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));2432 var endAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));2433 var startAngle = 2 * Math.PI * startAngleSource;2434 var endAngle = 2 * Math.PI * endAngleSource;2435 var rx = w * 0.5;2436 var ry = h * 0.5;2437 2438 var startX = rx + Math.sin(startAngle) * rx;2439 var startY = ry - Math.cos(startAngle) * ry;2440 var endX = rx + Math.sin(endAngle) * rx;2441 var endY = ry - Math.cos(endAngle) * ry;2442 2443 var angDiff = endAngle - startAngle;2444 2445 if (angDiff < 0)2446 {2447 angDiff = angDiff + Math.PI * 2;2448 }2449 2450 var bigArc = 0;2451 2452 if (angDiff >= Math.PI)2453 {2454 bigArc = 1;2455 }2456 2457 c.begin();2458 var startAngleDiff = startAngleSource % 1;2459 var endAngleDiff = endAngleSource % 1;2460 2461 if (startAngleDiff == 0 && endAngleDiff == 0.5)2462 {2463 c.moveTo(rx, ry);2464 c.lineTo(startX, startY);2465 c.arcTo(rx, ry, 0, 0, 1, w, h * 0.5);2466 c.arcTo(rx, ry, 0, 0, 1, w * 0.5, h);2467 }2468 else if (startAngleDiff == 0.5 && endAngleDiff == 0)2469 {2470 c.moveTo(rx, ry);2471 c.lineTo(startX, startY);2472 c.arcTo(rx, ry, 0, 0, 1, 0, h * 0.5);2473 c.arcTo(rx, ry, 0, 0, 1, w * 0.5, 0);2474 }2475 else2476 {2477 c.moveTo(rx, ry);2478 c.lineTo(startX, startY);2479 c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);2480 }2481 2482 c.close();2483 c.fillAndStroke();2484};24852486mxCellRenderer.registerShape(mxShapeBasicPie.prototype.cst.PIE, mxShapeBasicPie);24872488mxShapeBasicPie.prototype.constraints = null;24892490Graph.handleFactory[mxShapeBasicPie.prototype.cst.PIE] = function(state)2491{2492 var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)2493 {2494 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));24952496 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);2497 }, function(bounds, pt)2498 {2499 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2500 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2501 2502 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2503 2504 if (res < 0)2505 {2506 res = 1 + res;2507 }25082509 this.state.style['startAngle'] = res;2510 2511 })];25122513 var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)2514 {2515 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));25162517 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);2518 }, function(bounds, pt)2519 {2520 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2521 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2522 2523 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2524 2525 if (res < 0)2526 {2527 res = 1 + res;2528 }2529 2530 this.state.style['endAngle'] = res;2531 });2532 2533 handles.push(handle2);2534 2535 return handles;2536};25372538//**********************************************************************************************************************************************************2539//Arc2540//**********************************************************************************************************************************************************2541/**2542* Extends mxShape.2543*/2544function mxShapeBasicArc(bounds, fill, stroke, strokewidth)2545{2546 mxShape.call(this);2547 this.bounds = bounds;2548 this.fill = fill;2549 this.stroke = stroke;2550 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2551 this.startAngle = 0.25;2552 this.endAngle = 0.75;2553};25542555/**2556* Extends mxShape.2557*/2558mxUtils.extend(mxShapeBasicArc, mxActor);25592560mxShapeBasicArc.prototype.customProperties = [2561 {name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal: 0.3},2562 {name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal:0.1},2563 {name: 'startArrow', dispName: 'Start Arrow', type: 'enum', defVal: 'none',2564 enumList: [{val: 'none', dispName: 'None'}, {val: 'classic', dispName: 'Classic'},2565 {val: 'classicThin', dispName: 'Classic Thin'}, {val: 'open', dispName: 'Open'},2566 {val: 'openThin', dispName: 'Open Thin'}, {val: 'block', dispName: 'Block'},2567 {val: 'blockThin', dispName: 'Block Thin'}, {val: 'oval', dispName: 'Oval'},2568 {val: 'diamond', dispName: 'Diamond'}, {val: 'diamondThin', dispName: 'Diamond Thin'}]},2569 {name: 'endArrow', dispName: 'End Arrow', type: 'enum', defVal: 'none',2570 enumList: [{val: 'none', dispName: 'None'}, {val: 'classic', dispName: 'Classic'},2571 {val: 'classicThin', dispName: 'Classic Thin'}, {val: 'open', dispName: 'Open'},2572 {val: 'openThin', dispName: 'Open Thin'}, {val: 'block', dispName: 'Block'},2573 {val: 'blockThin', dispName: 'Block Thin'}, {val: 'oval', dispName: 'Oval'},2574 {val: 'diamond', dispName: 'Diamond'}, {val: 'diamondThin', dispName: 'Diamond Thin'}]},2575 {name: 'startFill', dispName: 'Start Fill', type: 'bool', defVal: true},2576 {name: 'endFill', dispName: 'End Fill', type: 'bool', defVal: true},2577 {name: 'startSize', dispName: 'Start Size', type: 'float', min: 1, defVal: 6},2578 {name: 'endSize', dispName: 'End Size', type: 'float', min: 1, defVal: 6}2579];25802581mxShapeBasicArc.prototype.cst = {ARC : 'mxgraph.basic.arc'};25822583/**2584* Function: paintVertexShape2585* 2586* Paints the vertex shape.2587*/2588mxShapeBasicArc.prototype.paintVertexShape = function(c, x, y, w, h)2589{2590 c.translate(x, y);25912592 var startAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));2593 var endAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));2594 var startAngle = 2 * Math.PI * startAngleSource;2595 var endAngle = 2 * Math.PI * endAngleSource;25962597 // Arrow markers2598 var startArrow = mxUtils.getValue(this.style, mxConstants.STYLE_STARTARROW, mxConstants.NONE);2599 var endArrow = mxUtils.getValue(this.style, mxConstants.STYLE_ENDARROW, mxConstants.NONE);2600 var startSize = mxUtils.getNumber(this.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_MARKERSIZE);2601 var endSize = mxUtils.getNumber(this.style, mxConstants.STYLE_ENDSIZE, mxConstants.DEFAULT_MARKERSIZE);26022603 // Inset ellipse to keep markers within shape bounds2604 var markerPadding = 0;26052606 if (startArrow != null && startArrow != mxConstants.NONE)2607 {2608 markerPadding = Math.max(markerPadding, startSize);2609 }26102611 if (endArrow != null && endArrow != mxConstants.NONE)2612 {2613 markerPadding = Math.max(markerPadding, endSize);2614 }26152616 if (markerPadding > 0)2617 {2618 markerPadding = (markerPadding + this.strokewidth) / 2;2619 }26202621 var cx = w * 0.5;2622 var cy = h * 0.5;2623 var rx = Math.max(0, w * 0.5 - markerPadding);2624 var ry = Math.max(0, h * 0.5 - markerPadding);26252626 var startX = cx + Math.sin(startAngle) * rx;2627 var startY = cy - Math.cos(startAngle) * ry;2628 var endX = cx + Math.sin(endAngle) * rx;2629 var endY = cy - Math.cos(endAngle) * ry;26302631 var startMarker = null;2632 var endMarker = null;26332634 if (startArrow != null && startArrow != mxConstants.NONE)2635 {2636 var startFilled = this.style[mxConstants.STYLE_STARTFILL] != 0;26372638 // Direction pointing into the start (opposite of clockwise tangent)2639 var dx = -rx * Math.cos(startAngle);2640 var dy = -ry * Math.sin(startAngle);2641 var dist = Math.sqrt(dx * dx + dy * dy);26422643 if (dist > 0)2644 {2645 var pe = new mxPoint(startX, startY);2646 startMarker = mxMarker.createMarker(c, this, startArrow, pe,2647 dx / dist, dy / dist, startSize, true, this.strokewidth, startFilled);2648 startX = pe.x;2649 startY = pe.y;2650 }2651 }26522653 if (endArrow != null && endArrow != mxConstants.NONE)2654 {2655 var endFilled = this.style[mxConstants.STYLE_ENDFILL] != 0;26562657 // Direction along the clockwise tangent at end2658 var dx = rx * Math.cos(endAngle);2659 var dy = ry * Math.sin(endAngle);2660 var dist = Math.sqrt(dx * dx + dy * dy);26612662 if (dist > 0)2663 {2664 var pe = new mxPoint(endX, endY);2665 endMarker = mxMarker.createMarker(c, this, endArrow, pe,2666 dx / dist, dy / dist, endSize, false, this.strokewidth, endFilled);2667 endX = pe.x;2668 endY = pe.y;2669 }2670 }26712672 // Draw arc2673 var angDiff = endAngle - startAngle;26742675 if (angDiff < 0)2676 {2677 angDiff = angDiff + Math.PI * 2;2678 }26792680 var bigArc = 0;26812682 if (angDiff > Math.PI)2683 {2684 bigArc = 1;2685 }26862687 c.begin();26882689 var startAngleDiff = startAngleSource % 1;2690 var endAngleDiff = endAngleSource % 1;26912692 if (startMarker == null && endMarker == null &&2693 startAngleDiff == 0 && endAngleDiff == 0.5)2694 {2695 c.moveTo(startX, startY);2696 c.arcTo(rx, ry, 0, 0, 1, cx + rx, cy);2697 c.arcTo(rx, ry, 0, 0, 1, cx, cy + ry);2698 }2699 else if (startMarker == null && endMarker == null &&2700 startAngleDiff == 0.5 && endAngleDiff == 0)2701 {2702 c.moveTo(startX, startY);2703 c.arcTo(rx, ry, 0, 0, 1, cx - rx, cy);2704 c.arcTo(rx, ry, 0, 0, 1, cx, cy - ry);2705 }2706 else2707 {2708 c.moveTo(startX, startY);2709 c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);2710 }27112712 c.stroke();27132714 // Paint markers2715 c.setShadow(false);2716 c.setDashed(false);27172718 if (startMarker != null)2719 {2720 c.setFillColor(mxUtils.getValue(this.style,2721 mxConstants.STYLE_STARTFILLCOLOR, this.stroke));2722 startMarker();2723 }27242725 if (endMarker != null)2726 {2727 c.setFillColor(mxUtils.getValue(this.style,2728 mxConstants.STYLE_ENDFILLCOLOR, this.stroke));2729 endMarker();2730 }2731};27322733mxCellRenderer.registerShape(mxShapeBasicArc.prototype.cst.ARC, mxShapeBasicArc);27342735mxShapeBasicArc.prototype.constraints = null;27362737Graph.handleFactory[mxShapeBasicArc.prototype.cst.ARC] = function(state)2738{2739 var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)2740 {2741 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));27422743 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);2744 }, function(bounds, pt)2745 {2746 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2747 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2748 2749 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2750 2751 if (res < 0)2752 {2753 res = 1 + res;2754 }27552756 this.state.style['startAngle'] = res;2757 2758 })];27592760 var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)2761 {2762 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));27632764 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);2765 }, function(bounds, pt)2766 {2767 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2768 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2769 2770 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2771 2772 if (res < 0)2773 {2774 res = 1 + res;2775 }2776 2777 this.state.style['endAngle'] = res;2778 });2779 2780 handles.push(handle2);2781 2782 return handles;2783};27842785//**********************************************************************************************************************************************************2786//Partial Concentric Ellipse2787//**********************************************************************************************************************************************************2788/**2789* Extends mxShape.2790*/2791function mxShapeBasicPartConcEllipse(bounds, fill, stroke, strokewidth)2792{2793 mxShape.call(this);2794 this.bounds = bounds;2795 this.fill = fill;2796 this.stroke = stroke;2797 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2798 this.startAngle = 0.25;2799 this.endAngle = 0.75;2800 this.arcWidth = 0.5;2801};28022803/**2804* Extends mxShape.2805*/2806mxUtils.extend(mxShapeBasicPartConcEllipse, mxActor);28072808mxShapeBasicPartConcEllipse.prototype.customProperties = [2809 {name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal:0.25},2810 {name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal:0.1},2811 {name: 'arcWidth', dispName: 'Arc Width', type: 'float', min:0, max:1, defVal:0.5}2812];28132814mxShapeBasicPartConcEllipse.prototype.cst = {PART_CONC_ELLIPSE : 'mxgraph.basic.partConcEllipse'};28152816/**2817* Function: paintVertexShape2818* 2819* Paints the vertex shape.2820*/2821mxShapeBasicPartConcEllipse.prototype.paintVertexShape = function(c, x, y, w, h)2822{2823 c.translate(x, y);28242825 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));2826 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));2827 var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));2828 var rx = w * 0.5;2829 var ry = h * 0.5;2830 var rx2 = rx * arcWidth;2831 var ry2 = ry * arcWidth;2832 2833 var angDiff = endAngle - startAngle;2834 2835 if (angDiff < 0)2836 {2837 angDiff = angDiff + Math.PI * 2;2838 }2839 else if (angDiff == Math.PI)2840 {2841 endAngle = endAngle + 0.00001;2842 }2843 2844 var startX = rx + Math.sin(startAngle) * rx;2845 var startY = ry - Math.cos(startAngle) * ry;2846 var innerStartX = rx + Math.sin(startAngle) * rx2;2847 var innerStartY = ry - Math.cos(startAngle) * ry2;2848 var endX = rx + Math.sin(endAngle) * rx;2849 var endY = ry - Math.cos(endAngle) * ry;2850 var innerEndX = rx + Math.sin(endAngle) * rx2;2851 var innerEndY = ry - Math.cos(endAngle) * ry2;2852 2853 2854 var bigArc = 0;2855 2856 if (angDiff >= Math.PI)2857 {2858 bigArc = 1;2859 }2860 2861 c.begin();2862 c.moveTo(startX, startY);2863 c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);2864 c.lineTo(innerEndX, innerEndY);2865 c.arcTo(rx2, ry2, 0, bigArc, 0, innerStartX, innerStartY);2866 c.close();2867 c.fillAndStroke();2868};28692870mxCellRenderer.registerShape(mxShapeBasicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE, mxShapeBasicPartConcEllipse);28712872mxShapeBasicPartConcEllipse.prototype.constraints = null;28732874Graph.handleFactory[mxShapeBasicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE] = function(state)2875{2876 var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)2877 {2878 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));28792880 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);2881 }, function(bounds, pt)2882 {2883 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2884 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2885 2886 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2887 2888 if (res < 0)2889 {2890 res = 1 + res;2891 }28922893 this.state.style['startAngle'] = res;2894 2895 })];28962897 var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)2898 {2899 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));29002901 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);2902 }, function(bounds, pt)2903 {2904 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;2905 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;2906 2907 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;2908 2909 if (res < 0)2910 {2911 res = 1 + res;2912 }2913 2914 this.state.style['endAngle'] = res;2915 });2916 2917 handles.push(handle2);2918 2919 var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)2920 {2921 var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));29222923 return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);2924 }, function(bounds, pt)2925 {2926 this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;2927 });2928 2929 handles.push(handle3);2930 2931 return handles;2932};29332934//**********************************************************************************************************************************************************2935//Numbered entry (vertical)2936//**********************************************************************************************************************************************************2937/**2938* Extends mxShape.2939*/2940function mxShapeBasicNumEntryVert(bounds, fill, stroke, strokewidth)2941{2942 mxShape.call(this);2943 this.bounds = bounds;2944 this.fill = fill;2945 this.stroke = stroke;2946 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2947 this.dy = 0.5;2948};29492950/**2951* Extends mxShape.2952*/2953mxUtils.extend(mxShapeBasicNumEntryVert, mxActor);29542955mxShapeBasicNumEntryVert.prototype.cst = {NUM_ENTRY_VERT : 'mxgraph.basic.numberedEntryVert'};29562957/**2958* Function: paintVertexShape2959* 2960* Paints the vertex shape.2961*/2962mxShapeBasicNumEntryVert.prototype.paintVertexShape = function(c, x, y, w, h)2963{2964 c.translate(x, y);29652966 var dy = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));29672968 var inset = 5;29692970 var d = Math.min(dy, w - 2 * inset, h - inset);2971 2972 c.ellipse(w * 0.5 - d * 0.5, 0, d, d);2973 c.fillAndStroke();2974 2975 c.begin();2976 c.moveTo(0, d * 0.5);2977 c.lineTo(w * 0.5 - d * 0.5 - inset, d * 0.5);2978 c.arcTo(d * 0.5 + inset, d * 0.5 + inset, 0, 0, 0, w * 0.5 + d * 0.5 + inset, d * 0.5);2979 c.lineTo(w, d * 0.5);2980 c.lineTo(w, h);2981 c.lineTo(0, h);2982 c.close();2983 c.fillAndStroke();2984};29852986mxCellRenderer.registerShape(mxShapeBasicNumEntryVert.prototype.cst.NUM_ENTRY_VERT, mxShapeBasicNumEntryVert);29872988mxShapeBasicNumEntryVert.prototype.constraints = null;29892990Graph.handleFactory[mxShapeBasicNumEntryVert.prototype.cst.NUM_ENTRY_VERT] = function(state)2991{2992 var handles = [Graph.createHandle(state, ['dy'], function(bounds)2993 {2994 var dy = Math.max(0, Math.min(bounds.width, bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));29952996 return new mxPoint(bounds.x + bounds.width / 2, bounds.y + dy);2997 }, function(bounds, pt)2998 {2999 this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height, bounds.width, pt.y - bounds.y))) / 100;3000 })];3001 3002 return handles;3003};30043005//**********************************************************************************************************************************************************3006//Bending Arch3007//**********************************************************************************************************************************************************3008/**3009* Extends mxShape.3010*/3011function mxShapeBasicBendingArch(bounds, fill, stroke, strokewidth)3012{3013 mxShape.call(this);3014 this.bounds = bounds;3015 this.fill = fill;3016 this.stroke = stroke;3017 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3018 this.startAngle = 0.25;3019 this.endAngle = 0.75;3020 this.arcWidth = 0.5;3021};30223023/**3024* Extends mxShape.3025*/3026mxUtils.extend(mxShapeBasicBendingArch, mxActor);30273028mxShapeBasicBendingArch.prototype.cst = {BENDING_ARCH : 'mxgraph.basic.bendingArch'};30293030/**3031* Function: paintVertexShape3032* 3033* Paints the vertex shape.3034*/3035mxShapeBasicBendingArch.prototype.paintVertexShape = function(c, x, y, w, h)3036{3037 c.translate(x, y);30383039 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));3040 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));3041 var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));3042 var rx = w * 0.5;3043 var ry = h * 0.5;3044 var rx2 = rx * arcWidth;3045 var ry2 = ry * arcWidth;3046 3047 var startX = rx + Math.sin(startAngle) * rx;3048 var startY = ry - Math.cos(startAngle) * ry;3049 var innerStartX = rx + Math.sin(startAngle) * rx2;3050 var innerStartY = ry - Math.cos(startAngle) * ry2;3051 var endX = rx + Math.sin(endAngle) * rx;3052 var endY = ry - Math.cos(endAngle) * ry;3053 var innerEndX = rx + Math.sin(endAngle) * rx2;3054 var innerEndY = ry - Math.cos(endAngle) * ry2;3055 3056 var angDiff = endAngle - startAngle;3057 3058 if (angDiff < 0)3059 {3060 angDiff = angDiff + Math.PI * 2;3061 }3062 3063 var bigArc = 0;3064 3065 if (angDiff > Math.PI)3066 {3067 bigArc = 1;3068 }30693070 var rx3 = rx2 - 5;3071 var ry3 = ry2 - 5;30723073 c.ellipse(w * 0.5 - rx3, h * 0.5 - ry3, 2 * rx3, 2 * ry3);3074 c.fillAndStroke();3075 3076 c.begin();3077 c.moveTo(startX, startY);3078 c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);3079 c.lineTo(innerEndX, innerEndY);3080 c.arcTo(rx2, ry2, 0, bigArc, 0, innerStartX, innerStartY);3081 c.close();3082 c.fillAndStroke();3083};30843085mxCellRenderer.registerShape(mxShapeBasicBendingArch.prototype.cst.BENDING_ARCH, mxShapeBasicBendingArch);30863087mxShapeBasicBendingArch.prototype.constraints = null;30883089Graph.handleFactory[mxShapeBasicBendingArch.prototype.cst.BENDING_ARCH] = function(state)3090{3091 var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)3092 {3093 var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));30943095 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);3096 }, function(bounds, pt)3097 {3098 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;3099 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;3100 3101 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;3102 3103 if (res < 0)3104 {3105 res = 1 + res;3106 }31073108 this.state.style['startAngle'] = res;3109 3110 })];31113112 var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)3113 {3114 var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));31153116 return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);3117 }, function(bounds, pt)3118 {3119 var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;3120 var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;3121 3122 var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;3123 3124 if (res < 0)3125 {3126 res = 1 + res;3127 }3128 3129 this.state.style['endAngle'] = res;3130 });3131 3132 handles.push(handle2);3133 3134 var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)3135 {3136 var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));31373138 return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);3139 }, function(bounds, pt)3140 {3141 this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;3142 });3143 3144 handles.push(handle3);3145 3146 return handles;3147};31483149//**********************************************************************************************************************************************************3150//Three Corner Round Rectangle3151//**********************************************************************************************************************************************************3152/**3153* Extends mxShape.3154*/3155function mxShapeBasicThreeCornerRoundRect(bounds, fill, stroke, strokewidth)3156{3157 mxShape.call(this);3158 this.bounds = bounds;3159 this.fill = fill;3160 this.stroke = stroke;3161 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3162 this.dx = 0.5;3163};31643165/**3166* Extends mxShape.3167*/3168mxUtils.extend(mxShapeBasicThreeCornerRoundRect, mxActor);31693170mxShapeBasicThreeCornerRoundRect.prototype.customProperties = [3171 {name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6}3172];31733174mxShapeBasicThreeCornerRoundRect.prototype.cst = {THREE_CORNER_ROUND_RECT : 'mxgraph.basic.three_corner_round_rect'};31753176/**3177* Function: paintVertexShape3178* 3179* Paints the vertex shape.3180*/3181mxShapeBasicThreeCornerRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)3182{3183 c.translate(x, y);31843185 var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;31863187 dx = Math.min(w * 0.5, h * 0.5, dx);3188 3189 c.begin();3190 c.moveTo(dx, 0);3191 c.lineTo(w - dx, 0);3192 c.arcTo(dx, dx, 0, 0, 1, w, dx);3193 c.lineTo(w, h - dx);3194 c.arcTo(dx, dx, 0, 0, 1, w - dx, h);3195 c.lineTo(0, h);3196 c.lineTo(0, dx);3197 c.arcTo(dx, dx, 0, 0, 1, dx, 0);3198 c.close();3199 c.fillAndStroke();3200};32013202mxCellRenderer.registerShape(mxShapeBasicThreeCornerRoundRect.prototype.cst.THREE_CORNER_ROUND_RECT, mxShapeBasicThreeCornerRoundRect);32033204mxShapeBasicThreeCornerRoundRect.prototype.constraints = null;32053206Graph.handleFactory[mxShapeBasicThreeCornerRoundRect.prototype.cst.THREE_CORNER_ROUND_RECT] = function(state)3207{3208 var handles = [Graph.createHandle(state, ['dx'], function(bounds)3209 {3210 var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));32113212 return new mxPoint(bounds.x + dx, bounds.y + dx);3213 }, function(bounds, pt)3214 {3215 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;3216 })];3217 3218 return handles;3219};32203221mxShapeBasicThreeCornerRoundRect.prototype.getConstraints = function(style, w, h)3222{3223 var constr = [];32243225 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));3226 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));3227 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));3228 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));3229 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));32303231 return (constr);3232}32333234//**********************************************************************************************************************************************************3235//Polygon3236//**********************************************************************************************************************************************************3237/**3238* Extends mxShape.3239*/3240function mxShapeBasicPolygon(bounds, fill, stroke, strokewidth)3241{3242 mxShape.call(this);3243 this.bounds = bounds;3244 this.fill = fill;3245 this.stroke = stroke;3246 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3247 this.dx = 0.5;3248 this.dy = 0.5;3249};32503251/**3252* Extends mxShape.3253*/3254mxUtils.extend(mxShapeBasicPolygon, mxActor);32553256mxShapeBasicPolygon.prototype.customProperties = [3257 {name: 'polyline', dispName: 'Polyline', type: 'bool', defVal:false},3258 {name: 'polyCurves', dispName: 'Curves', type: 'string', defVal: '[]'}3259];32603261mxShapeBasicPolygon.prototype.cst = {POLYGON : 'mxgraph.basic.polygon'};32623263/**3264* Function: paintVertexShape3265* 3266* Paints the vertex shape.3267*/3268mxShapeBasicPolygon.prototype.paintVertexShape = function(c, x, y, w, h)3269{3270 try3271 {3272 c.translate(x, y);3273 var coords = JSON.parse(mxUtils.getValue(this.state.style, 'polyCoords', '[]'));3274 var curves = JSON.parse(mxUtils.getValue(this.state.style, 'polyCurves', '[]'));3275 var polyline = mxUtils.getValue(this.style, 'polyline', false);32763277 if (coords.length > 0)3278 {3279 c.begin();3280 c.moveTo(coords[0][0] * w, coords[0][1] * h);32813282 for (var i = 1; i < coords.length; i++)3283 {3284 var ci = (curves.length > i - 1) ? curves[i - 1] : null;32853286 if (ci != null && ci.length >= 3 && ci[0] === 'Q')3287 {3288 c.quadTo(ci[1] * w, ci[2] * h, coords[i][0] * w, coords[i][1] * h);3289 }3290 else3291 {3292 c.lineTo(coords[i][0] * w, coords[i][1] * h);3293 }3294 }32953296 if (polyline == false)3297 {3298 var closeCurve = (curves.length >= coords.length) ? curves[coords.length - 1] : null;32993300 if (closeCurve != null && closeCurve.length >= 3 && closeCurve[0] === 'Q')3301 {3302 c.quadTo(closeCurve[1] * w, closeCurve[2] * h, coords[0][0] * w, coords[0][1] * h);3303 }33043305 c.close();3306 }33073308 c.end();3309 c.fillAndStroke();3310 }3311 }3312 catch (e)3313 {3314 // ignore3315 }3316};3317 3318mxCellRenderer.registerShape(mxShapeBasicPolygon.prototype.cst.POLYGON, mxShapeBasicPolygon);33193320mxShapeBasicPolygon.prototype.constraints = null;33213322(function()3323{3324 function createPolygonHandles(state)3325 {3326 var handles = [];33273328 try3329 {3330 var coords = JSON.parse(mxUtils.getValue(state.style, 'polyCoords', '[]'));3331 var curves = JSON.parse(mxUtils.getValue(state.style, 'polyCurves', '[]'));3332 var polyline = mxUtils.getValue(state.style, 'polyline', 0);3333 var isPolyline = polyline == 1 || polyline === true || polyline === 'true' || polyline === '1';3334 var minPoints = isPolyline ? 2 : 3;33353336 // Ensure curves array matches coords length3337 while (curves.length < coords.length)3338 {3339 curves.push([]);3340 }33413342 // Helper to refresh handler after structural changes3343 function refreshHandler()3344 {3345 var handler = state.view.graph.selectionCellsHandler.getHandler(state.cell);33463347 if (handler != null)3348 {3349 handler.refresh(state);3350 }3351 }33523353 // Vertex handles (move existing points)3354 for (var i = 0; i < coords.length; i++)3355 {3356 (function(index)3357 {3358 var handle = Graph.createHandle(state, ['polyCoords', 'polyCurves'], function(bounds)3359 {3360 return new mxPoint(bounds.x + coords[index][0] * bounds.width,3361 bounds.y + coords[index][1] * bounds.height);3362 }, function(bounds, pt)3363 {3364 var x = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;3365 var y = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;33663367 coords[index] = [x, y];3368 state.style['polyCoords'] = JSON.stringify(coords);3369 state.style['polyCurves'] = JSON.stringify(curves);3370 }, false);33713372 // Collinear removal on mouse up only (not during drag)3373 var vertexOrigExecute = handle.execute;33743375 handle.execute = function(me)3376 {3377 if (coords.length > minPoints)3378 {3379 var n = coords.length;3380 var prevIdx = (index - 1 + n) % n;3381 var nextIdx = (index + 1) % n;3382 var canRemove = !isPolyline || (index > 0 && index < n - 1);33833384 if (canRemove)3385 {3386 var bounds = this.state.getPaintBounds();3387 var px = coords[prevIdx][0] * bounds.width;3388 var py = coords[prevIdx][1] * bounds.height;3389 var nx = coords[nextIdx][0] * bounds.width;3390 var ny = coords[nextIdx][1] * bounds.height;3391 var cx = coords[index][0] * bounds.width;3392 var cy = coords[index][1] * bounds.height;33933394 if (mxUtils.ptSegDistSq(px, py, nx, ny, cx, cy) < 4)3395 {3396 coords.splice(index, 1);3397 curves.splice(index, 1);3398 state.style['polyCoords'] = JSON.stringify(coords);3399 state.style['polyCurves'] = JSON.stringify(curves);3400 vertexOrigExecute.apply(this, arguments);3401 refreshHandler();34023403 return;3404 }3405 }3406 }34073408 vertexOrigExecute.apply(this, arguments);3409 };34103411 handles.push(handle);3412 })(i);3413 }34143415 // Control point handles (adjust bezier control points)3416 for (var i = 0; i < curves.length && i < coords.length; i++)3417 {3418 (function(segIndex)3419 {3420 if (curves[segIndex] != null && curves[segIndex].length >= 3 && curves[segIndex][0] === 'Q')3421 {3422 var cpHandle = Graph.createHandle(state, ['polyCurves'], function(bounds)3423 {3424 return new mxPoint(bounds.x + curves[segIndex][1] * bounds.width,3425 bounds.y + curves[segIndex][2] * bounds.height);3426 }, function(bounds, pt)3427 {3428 var x = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;3429 var y = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;34303431 curves[segIndex] = ['Q', x, y];3432 state.style['polyCurves'] = JSON.stringify(curves);3433 }, false);34343435 // Visually distinct: override shape color3436 var cpOrigRedraw = cpHandle.redraw;34373438 cpHandle.redraw = function()3439 {3440 cpOrigRedraw.apply(this, arguments);34413442 if (this.shape != null && this.shape.node != null)3443 {3444 this.shape.node.setAttribute('fill', '#fca000');34453446 if (this.shape.node.firstChild != null)3447 {3448 this.shape.node.firstChild.setAttribute('fill', '#fca000');3449 }3450 }3451 };34523453 handles.push(cpHandle);3454 }3455 })(i);3456 }34573458 }3459 catch (e)3460 {3461 // ignore3462 }34633464 return handles;3465 }34663467 Graph.handleFactory[mxShapeBasicPolygon.prototype.cst.POLYGON] = createPolygonHandles;3468})();34693470//**********************************************************************************************************************************************************3471//Rectangle with pattern fill3472//**********************************************************************************************************************************************************3473/**3474* Extends mxShape.3475*/3476function mxShapeBasicPatternFillRect(bounds, fill, stroke, strokewidth)3477{3478 mxShape.call(this);3479 this.bounds = bounds;3480 this.fill = fill;3481 this.stroke = stroke;3482 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3483 this.dx = 0.5;3484};34853486/**3487* Extends mxShape.3488*/3489mxUtils.extend(mxShapeBasicPatternFillRect, mxActor);34903491mxShapeBasicPatternFillRect.prototype.cst = {PATTERN_FILL_RECT : 'mxgraph.basic.patternFillRect'};34923493mxShapeBasicPatternFillRect.prototype.customProperties = [3494 {name: 'step', dispName: 'Fill Step', type: 'float', min:0, defVal:5},3495 {name: 'fillStyle', dispName: 'Fill Style', type: 'enum', defVal:'none',3496 enumList:[3497 {val: 'none', dispName: 'None'},3498 {val: 'diag', dispName: 'Diagonal'},3499 {val: 'diagRev', dispName: 'Diagonal Reverse'},3500 {val: 'vert', dispName: 'Vertical'},3501 {val: 'hor', dispName: 'Horizontal'},3502 {val: 'grid', dispName: 'Grid'},3503 {val: 'diagGrid', dispName: 'Diagonal Grid'}3504 ]},3505 {name: 'fillStrokeWidth', dispName: 'Fill Stroke Width', type: 'float', min:0, defVal:1},3506 {name: 'fillStrokeColor', dispName: 'Fill Stroke Color', type: 'color', defVal:'#cccccc'},3507 {name: 'top', dispName: 'Top Line', type: 'bool', defVal:true},3508 {name: 'right', dispName: 'Right Line', type: 'bool', defVal:true},3509 {name: 'bottom', dispName: 'Bottom Line', type: 'bool', defVal:true},3510 {name: 'left', dispName: 'Left Line', type: 'bool', defVal:true}3511];35123513/**3514* Function: paintVertexShape3515* 3516* Paints the vertex shape.3517*/3518mxShapeBasicPatternFillRect.prototype.paintVertexShape = function(c, x, y, w, h)3519{3520 c.translate(x, y);3521 3522 var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');3523 var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', '1');3524 3525 c.rect(0, 0, w, h);3526 c.fill();35273528 var fillStrokeColor = mxUtils.getValue(this.style, 'fillStrokeColor', '#cccccc');3529 var fillStrokeWidth = parseFloat(mxUtils.getValue(this.style, 'fillStrokeWidth', 1));3530 3531 c.setStrokeColor(fillStrokeColor);3532 c.setStrokeWidth(fillStrokeWidth);3533 3534 var step = parseFloat(mxUtils.getValue(this.style, 'step', 5));3535 var fillStyle = mxUtils.getValue(this.style, 'fillStyle', 'none');35363537 if (fillStyle == 'diag' || fillStyle == 'diagGrid')3538 {3539 step = step * 1.41;3540 var i = 0;3541 3542 c.begin();3543 3544 while (i < (h + w))3545 {3546 var cx = 0;3547 var cy = 0;3548 3549 if (i <= h)3550 {3551 c.moveTo(0, i);3552 3553 if(i <= w)3554 {3555 c.lineTo(i, 0);3556 }3557 else3558 {3559 c.lineTo(w, i - w);3560 }3561 }3562 else3563 {3564 c.moveTo(i - h, h);3565 3566 if(i <= w)3567 {3568 c.lineTo(i, 0);3569 }3570 else3571 {3572 c.lineTo(w, i - w);3573 }3574 }3575 3576 i = i + step;3577 }3578 3579 c.stroke();3580 }3581 else if (fillStyle == 'vert' || fillStyle == 'grid')3582 {3583 c.begin();3584 var i = 0;3585 3586 while (i <= w)3587 {3588 var cx = 0;3589 var cy = 0;3590 3591 c.moveTo(i, 0);3592 c.lineTo(i, h);3593 3594 i = i + step;3595 }3596 3597 c.stroke();3598 }3599 3600 if (fillStyle == 'diagRev' || fillStyle == 'diagGrid')3601 {3602 if (fillStyle == 'diagRev')3603 {3604 step = step * 1.41;3605 }36063607 var i = 0;3608 3609 c.begin();3610 3611 while (i < (h + w))3612 {3613 var cx = 0;3614 var cy = 0;3615 3616 if (i <= h)3617 {3618 c.moveTo(w, i);3619 3620 if(i <= w)3621 {3622 c.lineTo(w - i, 0);3623 }3624 else3625 {3626 c.lineTo(w - w, i - w);3627 }3628 }3629 else3630 {3631 c.moveTo(w - i + h, h);3632 3633 if(i <= w)3634 {3635 c.lineTo(w - i, 0);3636 }3637 else3638 {3639 c.lineTo(0, i - w);3640 }3641 }3642 3643 i = i + step;3644 }3645 3646 c.stroke();3647 }3648 else if (fillStyle == 'hor' || fillStyle == 'grid')3649 {3650 c.begin();3651 var i = 0;3652 3653 while (i <= h)3654 {3655 var cx = 0;3656 var cy = 0;3657 3658 c.moveTo(0, i);3659 c.lineTo(w, i);3660 3661 i = i + step;3662 }3663 3664 c.stroke();3665 }36663667 c.setStrokeColor(strokeColor);3668 c.setStrokeWidth(strokeWidth);3669 3670 c.begin();3671 c.moveTo(0, 0);3672 3673 if (mxUtils.getValue(this.style, 'top', '1') == '1')3674 {3675 c.lineTo(w, 0);3676 }3677 else3678 {3679 c.moveTo(w, 0);3680 }3681 3682 if (mxUtils.getValue(this.style, 'right', '1') == '1')3683 {3684 c.lineTo(w, h);3685 }3686 else3687 {3688 c.moveTo(w, h);3689 }3690 3691 if (mxUtils.getValue(this.style, 'bottom', '1') == '1')3692 {3693 c.lineTo(0, h);3694 }3695 else3696 {3697 c.moveTo(0, h);3698 }3699 3700 if (mxUtils.getValue(this.style, 'left', '1') == '1')3701 {3702 c.lineTo(0, 0);3703 }3704 3705 c.end();3706 c.stroke();3707};37083709mxCellRenderer.registerShape(mxShapeBasicPatternFillRect.prototype.cst.PATTERN_FILL_RECT, mxShapeBasicPatternFillRect);37103711mxShapeBasicPatternFillRect.prototype.getConstraints = function(style, w, h)3712{3713 var constr = [];37143715 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));3716 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));3717 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));3718 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));3719 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));3720 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));3721 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));3722 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));3723 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));3724 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));3725 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));3726 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));3727 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));3728 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));3729 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));3730 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));3731 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));37323733 return (constr);3734}3735