<constrainToGrid/>
<constrainToGrid> is a Graphical
component that is used to constrain a <point> to a grid. The grid can be the default grid,
or a custom grid defined by the dx and dy attributes, or by the xOffset and yOffset attributes.
<constrainToGrid/> forces points to snap to gridline locations. The <constrainToGrid/>
component is nested within a <constraints> block.
Attributes and Properties
| Attribute | Type | Values |
|---|---|---|
dx = "…" | number | |
dy = "…" | number | |
dz = "…" | number | |
xoffset = "…" | number | |
yoffset = "…" | number | |
zoffset = "…" | number |
| Property | Type |
|---|---|
$c.disabled | boolean |
$c.dx | number |
$c.dy | number |
$c.dz | number |
$c.fixed | boolean |
$c.fixLocation | boolean |
$c.hidden | boolean |
$c.xoffset | number |
$c.yoffset | number |
$c.zoffset | number |
Example: Constrain a <point> to the default grid
The <point> is constrained to the default grid.
Example: Constrain a <circle> to the default grid
To constrain geometric objects other than points, first define a named <point> with the desired constraint, and then reference that point within the definition of the geometric object. The original <point> can be hidden using the hide attribute.
Example: Constrain a <point> to a custom grid
The <point> is constrained to a custom grid.
Attribute Example: dx, dy
The <point> is constrained to a custom grid using the dx and dy components. The grid specified for the <graph> does not affect the constraint grid, it is merely adjusted to match in this example for illustration.
Attribute Example: xOffset, yOffset
The <point> is constrained to the default grid with a specified xOffset and yOffset of .