Referencerectangle

<rectangle>

<rectangle> is a Graphical component that renders a rectangle when nested inside a <graph> component.

Attributes and Properties

Attributes for <rectangle>
AttributeTypeValues
allowDilation = "…"boolean"true" "false"
allowRotation = "…"boolean"true" "false"
allowTranslation = "…"boolean"true" "false"
applyStyleToLabel = "…"boolean"true" "false"
center = "…"[ math ]
displayDecimals = "…"integer
displayDigits = "…"integer
displaySmallAsZero = "…"number
draggable = "…"boolean"true" "false"
filled = "…"boolean"true" "false"
height = "…"number
labelIsName = "…"boolean"true" "false"
layer = "…"integer
minShrink = "…"
padZeros = "…"boolean"true" "false"
preserveSimilarity = "…"boolean"true" "false"
rigid = "…"boolean"true" "false"
rotateAround = "…""centroid" "vertex" "point"
rotationCenter = "…"
rotationHandleVertices = "…"
rotationVertex = "…"
showCoordsWhenDragging = "…"boolean"true" "false"
vertices = "…"[ math ]
verticesDraggable = "…"boolean"true" "false"
width = "…"number
Props for <rectangle name="r">
PropertyType
$r.allowDilationboolean
$r.allowRotationboolean
$r.allowTranslationboolean
$r.applyStyleToLabelboolean
$r.areanumber
$r.borderStyleDescriptiontext
$r.center[ math ]
$r.disabledboolean
$r.displayDecimalsinteger
$r.displayDigitsinteger
$r.displaySmallAsZeronumber
$r.draggableboolean
$r.filledboolean
$r.fillStyleDescriptiontext
$r.fixedboolean
$r.fixLocationboolean
$r.heightnumber
$r.hiddenboolean
$r.labellabel
$r.labelIsNameboolean
$r.layerinteger
$r.numDimensionsnumber
$r.numSidesnumber
$r.numVerticesnumber
$r.padZerosboolean
$r.perimeternumber
$r.preserveSimilarityboolean
$r.rigidboolean
$r.showCoordsWhenDraggingboolean
$r.styleDescriptiontext
$r.styleDescriptionWithNountext
$r.vertices[ math ]
$r.verticesDraggableboolean
$r.widthnumber

Example: Default <rectangle>

This is a default <rectangle> without additional attributes. The vertices can be dragged to change its shape, and the rectangle itself can be repositioned by clicking and dragging on any side.


Example: <rectangle> with center, width and height

A <rectangle> can be described by specifying its center, width and height with attributes. The vertices can be dragged to change its shape, and the rectangle itself can be repositioned by clicking and dragging on any side.


Example: Filled colored <rectangle>

The filled attribute renders the rectangle with default shading to match the styleNumber.


Example: <rectangle> from vertices

Use the vertices attribute to specify a list of the two opposite corner points of the rectangle (lower left and upper right); default: vertices=“(0,0) (1,1)“


Example: <rectangle> constrained to a grid

A rectangle is effectively constrained to an integer grid by referencing two constrained points in the vertices attribute.


Attribute Example: center

Use the center attribute to specify the center point of the rectangle. If not specified, the default center position is (0.5,0.5)(0.5, 0.5).


Attribute Example: width, height

Use the width and height attributes to specify the proportions of the <rectangle> directly. If not specified, the default values for width and height are both 11.


Attribute Example: vertices

Use the vertices attribute to specify a list of the two opposite corner points of the rectangle (lower left and upper right); default: vertices=“(0,0) (1,1)“


Attribute Example: verticesDraggable

Vertices are draggable by default. Use the verticesDraggable attribute set to false to disable users from changing the proportions of the <rectangle>. The rectangle as a whole can still be repositioned on the <graph>.


Attribute Example: Standard graphical attributes

The uses of the following standard graphical attributes are illustrated: hide, draggable, layer, styleNumber, applyStyleToLabel and labelIsName.


Property Example: Attributes as properties

The above listed attributes of a named <rectangle> are also available as properties.