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 / mockup / mxMockupMarkup.js
mxMockupMarkup.js 6.0K
1/**2 * Copyright (c) 2006-2010, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Horizontal Curly Brace7//**********************************************************************************************************************************************************8/**9 * Extends mxShape.10 */11function mxShapeMockupCurlyBrace(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21 * Extends mxShape.22 */23mxUtils.extend(mxShapeMockupCurlyBrace, mxShape);2425mxShapeMockupCurlyBrace.prototype.cst = {26 SHAPE_CURLY_BRACE : 'mxgraph.mockup.markup.curlyBrace'27};2829/**30 * Function: paintVertexShape31 * 32 * Paints the vertex shape.33 */34mxShapeMockupCurlyBrace.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);37 this.background(c, x, y, w, h);38};3940mxShapeMockupCurlyBrace.prototype.background = function(c, x, y, w, h)41{42 var midY = h * 0.5;43 var rSize = Math.min(w * 0.125, midY);44 c.begin();45 c.moveTo(0, midY + rSize);46 c.arcTo(rSize, rSize, 0, 0, 1, rSize, midY);47 c.lineTo(w * 0.5 - rSize, midY);48 c.arcTo(rSize, rSize, 0, 0, 0, w * 0.5, midY - rSize);49 c.arcTo(rSize, rSize, 0, 0, 0, w * 0.5 + rSize, midY);50 c.lineTo(w - rSize, midY);51 c.arcTo(rSize, rSize, 0, 0, 1, w, midY + rSize);52 c.stroke();53};5455mxCellRenderer.registerShape(mxShapeMockupCurlyBrace.prototype.cst.SHAPE_CURLY_BRACE, mxShapeMockupCurlyBrace);5657//**********************************************************************************************************************************************************58//Line59//**********************************************************************************************************************************************************60/**61* Extends mxShape.62*/63function mxShapeMockupLine(bounds, fill, stroke, strokewidth)64{65 mxShape.call(this);66 this.bounds = bounds;67 this.fill = fill;68 this.stroke = stroke;69 this.strokewidth = (strokewidth != null) ? strokewidth : 1;70};7172/**73* Extends mxShape.74*/75mxUtils.extend(mxShapeMockupLine, mxShape);7677mxShapeMockupLine.prototype.cst = {78 SHAPE_LINE : 'mxgraph.mockup.markup.line'79};8081/**82* Function: paintVertexShape83* 84* Paints the vertex shape.85*/86mxShapeMockupLine.prototype.paintVertexShape = function(c, x, y, w, h)87{88 c.translate(x, y);89 c.begin();90 c.moveTo(0, h * 0.5);91 c.lineTo(w, h * 0.5);92 c.stroke();93};9495mxCellRenderer.registerShape(mxShapeMockupLine.prototype.cst.SHAPE_LINE, mxShapeMockupLine);9697//**********************************************************************************************************************************************************98//Scratch Out99//**********************************************************************************************************************************************************100/**101* Extends mxShape.102*/103function mxShapeMockupScratchOut(bounds, fill, stroke, strokewidth)104{105 mxShape.call(this);106 this.bounds = bounds;107 this.fill = fill;108 this.stroke = stroke;109 this.strokewidth = (strokewidth != null) ? strokewidth : 1;110};111112/**113* Extends mxShape.114*/115mxUtils.extend(mxShapeMockupScratchOut, mxShape);116117mxShapeMockupScratchOut.prototype.cst = {118 SHAPE_SCRATCH_OUT : 'mxgraph.mockup.markup.scratchOut'119};120121/**122* Function: paintVertexShape123* 124* Paints the vertex shape.125*/126mxShapeMockupScratchOut.prototype.paintVertexShape = function(c, x, y, w, h)127{128 c.translate(x, y);129 c.begin();130 c.moveTo(w * 0.038, h * 0.095);131 c.curveTo(w * 0.038, h * 0.095, w * 0.289, h * -0.045, w * 0.186, h * 0.05);132 c.curveTo(w * 0.084, h * 0.145, w * -0.046, h * 0.251, w * 0.072, h * 0.208);133 c.curveTo(w * 0.191, h * 0.164, w * 0.522, h * -0.09, w * 0.366, h * 0.062);134 c.curveTo(w * 0.21, h * 0.215, w * -0.094, h * 0.38, w * 0.108, h * 0.304);135 c.curveTo(w * 0.309, h * 0.228, w * 0.73, h * -0.126, w * 0.544, h * 0.096);136 c.curveTo(w * 0.358, h * 0.319, w * -0.168, h * 0.592, w * 0.108, h * 0.476);137 c.curveTo(w * 0.382, h * 0.36, w * 0.972, h * -0.138, w * 0.779, h * 0.114);138 c.curveTo(w * 0.585, h * 0.365, w * -0.12, h * 0.688, w * 0.071, h * 0.639);139 c.curveTo(w * 0.262, h * 0.59, w * 1.174, h * 0.012, w * 0.936, h * 0.238);140 c.curveTo(w * 0.699, h * 0.462, w * -0.216, h * 0.855, w * 0.085, h * 0.806);141 c.curveTo(w * 0.386, h * 0.758, w * 1.185, h * 0.26, w * 0.935, h * 0.534);142 c.curveTo(w * 0.685, h * 0.808, w * -0.186, h * 0.94, w * 0.236, h * 0.895);143 c.curveTo(w * 0.659, h * 0.85, w * 1.095, h * 0.608, w * 0.905, h * 0.769);144 c.curveTo(w * 0.715, h * 0.93, w * 0.286, h * 0.962, w * 0.661, h * 0.931);145 c.stroke();146};147148mxCellRenderer.registerShape(mxShapeMockupScratchOut.prototype.cst.SHAPE_SCRATCH_OUT, mxShapeMockupScratchOut);149150//**********************************************************************************************************************************************************151//Red X152//**********************************************************************************************************************************************************153/**154* Extends mxShape.155*/156function mxShapeMockupRedX(bounds, fill, stroke, strokewidth)157{158 mxShape.call(this);159 this.bounds = bounds;160 this.fill = fill;161 this.stroke = stroke;162 this.strokewidth = (strokewidth != null) ? strokewidth : 1;163};164165/**166* Extends mxShape.167*/168mxUtils.extend(mxShapeMockupRedX, mxShape);169170mxShapeMockupRedX.prototype.cst = {171 SHAPE_RED_X : 'mxgraph.mockup.markup.redX'172};173174/**175* Function: paintVertexShape176* 177* Paints the vertex shape.178*/179mxShapeMockupRedX.prototype.paintVertexShape = function(c, x, y, w, h)180{181 c.translate(x, y);182 c.begin();183 c.moveTo(w * 0.1, 0);184 c.lineTo(w * 0.5, h * 0.4);185 c.lineTo(w * 0.9, 0);186 c.lineTo(w, h * 0.1);187 c.lineTo(w * 0.6, h * 0.5);188 c.lineTo(w, h * 0.9);189 c.lineTo(w * 0.9, h);190 c.lineTo(w * 0.5, h * 0.6);191 c.lineTo(w * 0.1, h);192 c.lineTo(0, h * 0.9);193 c.lineTo(w * 0.4, h * 0.5);194 c.lineTo(0, h * 0.1);195 c.close();196 c.fillAndStroke();197};198199mxCellRenderer.registerShape(mxShapeMockupRedX.prototype.cst.SHAPE_RED_X, mxShapeMockupRedX);