<attractToGrid/>
<attractToGrid> is a Graphical component that
is used within a <point> to attract it to a specified grid.
Attributes and Properties
Attributes for <attractToGrid>
Other (10)
number. Default value: 1. Horizontal grid spacing.
number. Default value: 1. Vertical grid spacing.
dznumber. Default value: 1. Depth-wise grid spacing.
includeGridlinesboolean. Default value: false. Whether to attract to entire grid lines (in addition to grid intersection points).
number. Default value: 0. Horizontal offset of the grid origin.
number. Default value: 0.2. Horizontal distance within which the position attracts to a grid line.
number. Default value: 0. Vertical offset of the grid origin.
number. Default value: 0.2. Vertical distance within which the position attracts to a grid line.
zoffsetnumber. Default value: 0. Depth-wise offset of the grid origin.
zthresholdnumber. Default value: 0.2. Depth-wise distance within which the position attracts to a grid line.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <attractToGrid name="a">
Other (14)
$a.disabledboolean. Whether this component is disabled and cannot be interacted with.
$a.dxnumber. Horizontal grid spacing.
$a.dynumber. Vertical grid spacing.
$a.dznumber. Depth-wise grid spacing.
$a.fixedboolean. Whether this component's value is fixed and cannot be modified.
$a.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$a.includeGridlinesboolean. Whether to attract to entire grid lines (in addition to grid intersection points).
$a.xoffsetnumber. Horizontal offset of the grid origin.
$a.xthresholdnumber. Horizontal distance within which the position attracts to a grid line.
$a.yoffsetnumber. Vertical offset of the grid origin.
$a.ythresholdnumber. Vertical distance within which the position attracts to a grid line.
$a.zoffsetnumber. Depth-wise offset of the grid origin.
$a.zthresholdnumber. Depth-wise distance within which the position attracts to a grid line.
Common to all components (4)
$a.doenetMLtext. The DoenetML source code that produced this component.
$a.hideboolean. Whether to hide this component from the rendered output.
$a.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$a.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Attract <point> to a grid, default behavior
The default grid spacing for attraction for a <point> with
the <attractToGrid> constraint is 1.
Attribute Examples
Attribute Example: dx, dy
The dx and dy attributes allow for customization of the attraction grid.
Note that it is not required to display the grid in the graph; this is done for illustration.
Attribute Example: xOffset, yOffset
With the xOffset and yOffset attributes, the spacing of attraction gridlines can be adjusted to a
specific offset of the specified dx and dy.
The grey points are included as an illustration of where the offset attraction grids occur.
Attribute Example: xThreshold, yThreshold
The xThreshold and yThreshold attributes can be used to control how close the <point> must be to
a grid for attraction to take effect. Notice the different behavior above when dragging the point
close to the gridlines and gridlines.
Property Examples
Property Example: Attributes as properties
The attributes of <attractToGrid/> shown in the example above are also available as properties.