Class: rect

rect

Shortcut for creating SVG rects.

new rect(options){rect}

Initializes a new rect instance.
Name Type Description
options Object Options used to customize the rect
Name Type Default Description
parent * optional SVGElement which to append the primary element
id String optional The id of the instance. Auto-generated when not provided
x Number 0 optional Origin of the rectangle along the x-axis
y Number 0 optional Origin of the rectangle along the y-axis
width Number 50 optional Width fo the rectangle
height Number 30 optional Height fo the rectangle
rx Number 0 optional x-axis radius of the ellipse used to round off the corners of the rectangle
ry Number 0 optional y-axis radius of the ellipse used to round off the corners of the rectangle
fill String 'transparent' optional The default fill color
stroke String '#000000' optional The default stroke color
strokeWidth Number 1 optional The default stroke width
attr Object optional Attributes to apply to the rect's SVGElement element.
css Object optional CSS Properties to apply to the rect's SVGElement element.
Returns:
Type Description
rect A new rect instance.

Requires

Members

dasharray*

The stroke-dasharray of the primary element

dashoffset*

The stroke-dashoffset of the primary element

readonlyelSVGElement

The SVGElement element associated with this instance

fillString

The rect's fill color

heightNumber

Height of the rectangle

readonlyidString

The id of this instance's SVGElement element

readonlyparentSVGElement

The parent of the primary element

rxNumber

x-axis radius of the ellipse used to round off the corners of the rectangle

ryNumber

y-axis radius of the ellipse used to round off the corners of the rectangle

sliceString

Control how much of the primary element's stroke is drawn. Space-delimited values define a slice, ie '10 30'. A single value asserts 0 as the starting value. Accepts percentages for relative values

strokeString

The rect's stroke color

strokeWidthNumber

The rect's stroke width

widthNumber

Width of the rectangle

xNumber

Origin of the rectangle along the x-axis

yNumber

Origin of the rectangle along the y-axis

Methods

staticrect.getElInstance(el){rect}

returns the rect instance associated with the provided element's id attribute
Name Type Description
el Element The element with the lookup id
Returns:
Type Description
rect The associated rect, if it exists

staticrect.getInstance(id){rect}

returns the rect instance associated with the id
Name Type Description
id String The lookup id
Returns:
Type Description
rect The associated rect, if it exists