1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */4//**********************************************************************************************************************************************************5// Document 26//**********************************************************************************************************************************************************7/**8* Extends mxShape.9*/10function mxShapeFlowchartDocument2(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.size = 0.5;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxShapeFlowchartDocument2, mxActor);2425mxShapeFlowchartDocument2.prototype.cst = {DOCUMENT2 : 'mxgraph.flowchart.document2'};2627mxShapeFlowchartDocument2.prototype.customProperties = [28 {name: 'size', dispName: 'Wave Size', type: 'float', min:0, max:1, defVal:0.25},29];3031/**32* Function: paintVertexShape33* 34* Paints the vertex shape.35*/36mxShapeFlowchartDocument2.prototype.paintVertexShape = function(c, x, y, w, h)37{38 c.translate(x, y);3940 var dy = h * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'size', this.size))));41 var fy = 1.4;42 var r = 5;43 44 c.begin();45 c.moveTo(w - r, 0);46 c.arcTo(r, r, 0, 0, 1, w, r);47 c.lineTo(w, h - dy / 2);48 c.quadTo(w * 3 / 4, h - dy * fy, w / 2, h - dy / 2);49 c.quadTo(w / 4, h - dy * (1 - fy), 0, h - dy / 2);50 c.lineTo(0, dy / 2);51 c.lineTo(0, r);52 c.arcTo(r, r, 0, 0, 1, r, 0);53 c.close();54 c.fillAndStroke();5556};5758mxCellRenderer.registerShape(mxShapeFlowchartDocument2.prototype.cst.DOCUMENT2, mxShapeFlowchartDocument2);5960mxShapeFlowchartDocument2.prototype.constraints =61 [new mxConnectionConstraint(new mxPoint(0.25, 0), false),62 new mxConnectionConstraint(new mxPoint(0.5, 0), false),63 new mxConnectionConstraint(new mxPoint(0.75, 0), false),64 new mxConnectionConstraint(new mxPoint(0, 0.25), false),65 new mxConnectionConstraint(new mxPoint(0, 0.5), false),66 new mxConnectionConstraint(new mxPoint(0, 0.75), false),67 new mxConnectionConstraint(new mxPoint(1, 0.25), false),68 new mxConnectionConstraint(new mxPoint(1, 0.5), false),69 new mxConnectionConstraint(new mxPoint(1, 0.75), false)];7071Graph.handleFactory[mxShapeFlowchartDocument2.prototype.cst.DOCUMENT2] = function(state)72{73 var handles = [Graph.createHandle(state, ['size'], function(bounds)74 {75 var size = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'size', this.size))));7677 return new mxPoint(bounds.x + 3 * bounds.width / 4, bounds.y + (1 - size) * bounds.height);7879 }, function(bounds, pt)80 {81 this.state.style['size'] = Math.max(0, Math.min(1, (bounds.y + bounds.height - pt.y) / bounds.height));82 })];83 84 return handles;85};