1/** 2 * $Id: mxMockupMarkup.js,v 1.5 2013/02/27 14:30:39 mate Exp $ 3 * Copyright (c) 2006-2010, JGraph Ltd 4 */ 5 6//********************************************************************************************************************************************************** 7//Horizontal Curly Brace 8//********************************************************************************************************************************************************** 9/** 10 * Extends mxShape. 11 */ 12function mxShapeMockupCurlyBrace(bounds, fill, stroke, strokewidth) 13{ 14 mxShape.call(this); 15 this.bounds = bounds; 16 this.fill = fill; 17 this.stroke = stroke; 18 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 19}; 20 21/** 22 * Extends mxShape. 23 */ 24mxUtils.extend(mxShapeMockupCurlyBrace, mxShape); 25 26mxShapeMockupCurlyBrace.prototype.cst = { 27 SHAPE_CURLY_BRACE : 'mxgraph.mockup.markup.curlyBrace' 28}; 29 30/** 31 * Function: paintVertexShape 32 * 33 * Paints the vertex shape. 34 */ 35mxShapeMockupCurlyBrace.prototype.paintVertexShape = function(c, x, y, w, h) 36{ 37 c.translate(x, y); 38 this.background(c, x, y, w, h); 39}; 40 41mxShapeMockupCurlyBrace.prototype.background = function(c, x, y, w, h) 42{ 43 var midY = h * 0.5; 44 var rSize = Math.min(w * 0.125, midY); 45 c.begin(); 46 c.moveTo(0, midY + rSize); 47 c.arcTo(rSize, rSize, 0, 0, 1, rSize, midY); 48 c.lineTo(w * 0.5 - rSize, midY); 49 c.arcTo(rSize, rSize, 0, 0, 0, w * 0.5, midY - rSize); 50 c.arcTo(rSize, rSize, 0, 0, 0, w * 0.5 + rSize, midY); 51 c.lineTo(w - rSize, midY); 52 c.arcTo(rSize, rSize, 0, 0, 1, w, midY + rSize); 53 c.stroke(); 54}; 55 56mxCellRenderer.registerShape(mxShapeMockupCurlyBrace.prototype.cst.SHAPE_CURLY_BRACE, mxShapeMockupCurlyBrace); 57 58//********************************************************************************************************************************************************** 59//Line 60//********************************************************************************************************************************************************** 61/** 62* Extends mxShape. 63*/ 64function mxShapeMockupLine(bounds, fill, stroke, strokewidth) 65{ 66 mxShape.call(this); 67 this.bounds = bounds; 68 this.fill = fill; 69 this.stroke = stroke; 70 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 71}; 72 73/** 74* Extends mxShape. 75*/ 76mxUtils.extend(mxShapeMockupLine, mxShape); 77 78mxShapeMockupLine.prototype.cst = { 79 SHAPE_LINE : 'mxgraph.mockup.markup.line' 80}; 81 82/** 83* Function: paintVertexShape 84* 85* Paints the vertex shape. 86*/ 87mxShapeMockupLine.prototype.paintVertexShape = function(c, x, y, w, h) 88{ 89 c.translate(x, y); 90 c.begin(); 91 c.moveTo(0, h * 0.5); 92 c.lineTo(w, h * 0.5); 93 c.stroke(); 94}; 95 96mxCellRenderer.registerShape(mxShapeMockupLine.prototype.cst.SHAPE_LINE, mxShapeMockupLine); 97 98//********************************************************************************************************************************************************** 99//Scratch Out 100//********************************************************************************************************************************************************** 101/** 102* Extends mxShape. 103*/ 104function mxShapeMockupScratchOut(bounds, fill, stroke, strokewidth) 105{ 106 mxShape.call(this); 107 this.bounds = bounds; 108 this.fill = fill; 109 this.stroke = stroke; 110 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 111}; 112 113/** 114* Extends mxShape. 115*/ 116mxUtils.extend(mxShapeMockupScratchOut, mxShape); 117 118mxShapeMockupScratchOut.prototype.cst = { 119 SHAPE_SCRATCH_OUT : 'mxgraph.mockup.markup.scratchOut' 120}; 121 122/** 123* Function: paintVertexShape 124* 125* Paints the vertex shape. 126*/ 127mxShapeMockupScratchOut.prototype.paintVertexShape = function(c, x, y, w, h) 128{ 129 c.translate(x, y); 130 c.begin(); 131 c.moveTo(w * 0.038, h * 0.095); 132 c.curveTo(w * 0.038, h * 0.095, w * 0.289, h * -0.045, w * 0.186, h * 0.05); 133 c.curveTo(w * 0.084, h * 0.145, w * -0.046, h * 0.251, w * 0.072, h * 0.208); 134 c.curveTo(w * 0.191, h * 0.164, w * 0.522, h * -0.09, w * 0.366, h * 0.062); 135 c.curveTo(w * 0.21, h * 0.215, w * -0.094, h * 0.38, w * 0.108, h * 0.304); 136 c.curveTo(w * 0.309, h * 0.228, w * 0.73, h * -0.126, w * 0.544, h * 0.096); 137 c.curveTo(w * 0.358, h * 0.319, w * -0.168, h * 0.592, w * 0.108, h * 0.476); 138 c.curveTo(w * 0.382, h * 0.36, w * 0.972, h * -0.138, w * 0.779, h * 0.114); 139 c.curveTo(w * 0.585, h * 0.365, w * -0.12, h * 0.688, w * 0.071, h * 0.639); 140 c.curveTo(w * 0.262, h * 0.59, w * 1.174, h * 0.012, w * 0.936, h * 0.238); 141 c.curveTo(w * 0.699, h * 0.462, w * -0.216, h * 0.855, w * 0.085, h * 0.806); 142 c.curveTo(w * 0.386, h * 0.758, w * 1.185, h * 0.26, w * 0.935, h * 0.534); 143 c.curveTo(w * 0.685, h * 0.808, w * -0.186, h * 0.94, w * 0.236, h * 0.895); 144 c.curveTo(w * 0.659, h * 0.85, w * 1.095, h * 0.608, w * 0.905, h * 0.769); 145 c.curveTo(w * 0.715, h * 0.93, w * 0.286, h * 0.962, w * 0.661, h * 0.931); 146 c.stroke(); 147}; 148 149mxCellRenderer.registerShape(mxShapeMockupScratchOut.prototype.cst.SHAPE_SCRATCH_OUT, mxShapeMockupScratchOut); 150 151//********************************************************************************************************************************************************** 152//Red X 153//********************************************************************************************************************************************************** 154/** 155* Extends mxShape. 156*/ 157function mxShapeMockupRedX(bounds, fill, stroke, strokewidth) 158{ 159 mxShape.call(this); 160 this.bounds = bounds; 161 this.fill = fill; 162 this.stroke = stroke; 163 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 164}; 165 166/** 167* Extends mxShape. 168*/ 169mxUtils.extend(mxShapeMockupRedX, mxShape); 170 171mxShapeMockupRedX.prototype.cst = { 172 SHAPE_RED_X : 'mxgraph.mockup.markup.redX' 173}; 174 175/** 176* Function: paintVertexShape 177* 178* Paints the vertex shape. 179*/ 180mxShapeMockupRedX.prototype.paintVertexShape = function(c, x, y, w, h) 181{ 182 c.translate(x, y); 183 c.begin(); 184 c.moveTo(w * 0.1, 0); 185 c.lineTo(w * 0.5, h * 0.4); 186 c.lineTo(w * 0.9, 0); 187 c.lineTo(w, h * 0.1); 188 c.lineTo(w * 0.6, h * 0.5); 189 c.lineTo(w, h * 0.9); 190 c.lineTo(w * 0.9, h); 191 c.lineTo(w * 0.5, h * 0.6); 192 c.lineTo(w * 0.1, h); 193 c.lineTo(0, h * 0.9); 194 c.lineTo(w * 0.4, h * 0.5); 195 c.lineTo(0, h * 0.1); 196 c.close(); 197 c.fillAndStroke(); 198}; 199 200mxCellRenderer.registerShape(mxShapeMockupRedX.prototype.cst.SHAPE_RED_X, mxShapeMockupRedX);