diff options
Diffstat (limited to 'src/js/shape/mxRectangleShape.js')
-rw-r--r-- | src/js/shape/mxRectangleShape.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/js/shape/mxRectangleShape.js b/src/js/shape/mxRectangleShape.js new file mode 100644 index 0000000..26688c3 --- /dev/null +++ b/src/js/shape/mxRectangleShape.js @@ -0,0 +1,61 @@ +/** + * $Id: mxRectangleShape.js,v 1.17 2012-09-26 07:51:29 gaudenz Exp $ + * Copyright (c) 2006-2010, JGraph Ltd + */ +/** + * Class: mxRectangleShape + * + * Extends <mxShape> to implement a rectangle shape. + * This shape is registered under <mxConstants.SHAPE_RECTANGLE> + * in <mxCellRenderer>. + * + * Constructor: mxRectangleShape + * + * Constructs a new rectangle shape. + * + * Parameters: + * + * bounds - <mxRectangle> that defines the bounds. This is stored in + * <mxShape.bounds>. + * fill - String that defines the fill color. This is stored in <fill>. + * stroke - String that defines the stroke color. This is stored in <stroke>. + * strokewidth - Optional integer that defines the stroke width. Default is + * 1. This is stored in <strokewidth>. + */ +function mxRectangleShape(bounds, fill, stroke, strokewidth) +{ + this.bounds = bounds; + this.fill = fill; + this.stroke = stroke; + this.strokewidth = (strokewidth != null) ? strokewidth : 1; +}; + +/** + * Extends mxShape. + */ +mxRectangleShape.prototype = new mxShape(); +mxRectangleShape.prototype.constructor = mxRectangleShape; + +/** + * Function: createVml + * + * Creates and returns the VML node to represent this shape. + */ +mxRectangleShape.prototype.createVml = function() +{ + var name = (this.isRounded) ? 'v:roundrect' : 'v:rect'; + var node = document.createElement(name); + this.configureVmlShape(node); + + return node; +}; + +/** + * Function: createSvg + * + * Creates and returns the SVG node to represent this shape. + */ +mxRectangleShape.prototype.createSvg = function() +{ + return this.createSvgGroup('rect'); +}; |