<pegboard/>
<pegboard/> is a Graphical component
that renders a grid of small dots (“pegs”) covering the visible region of an enclosing <graph>.
The peg spacing and offset are controlled by dx, dy, xoffset, and yoffset. The pegboard
re-tiles automatically as the user pans or zooms the graph.
A <pegboard/> does not, on its own, cause other graphical objects to snap. To make a
<point> snap to peg locations, pair the pegboard with an
<attractToGrid/> or <constrainToGrid/> constraint using the
same dx, dy, xOffset, and yOffset values.
Attributes and Properties
Attributes for <pegboard>
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Other (6)
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
number. Default value: 1. Horizontal spacing between pegs.
number. Default value: 1. Vertical spacing between pegs.
layerinteger. Default value: 0. Z-order layer index used to stack graphical components (higher values render on top).
number. Default value: 0. Horizontal offset of the peg grid origin.
number. Default value: 0. Vertical offset of the peg grid origin.
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 <pegboard name="p">
Labels (2)
$p.labellabel. The label rendered with this component.
$p.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (10)
$p.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$p.disabledboolean. Whether this component is disabled and cannot be interacted with.
$p.dxnumber. Horizontal spacing between pegs.
$p.dynumber. Vertical spacing between pegs.
$p.fixedboolean. Whether this component's value is fixed and cannot be modified.
$p.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$p.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$p.xoffsetnumber. Horizontal offset of the peg grid origin.
$p.yoffsetnumber. Vertical offset of the peg grid origin.
Common to all components (4)
$p.doenetMLtext. The DoenetML source code that produced this component.
$p.hideboolean. Whether to hide this component from the rendered output.
$p.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$p.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: A default pegboard
With the default attributes, pegs appear at every integer coordinate of the graph.
Example: Pegboard paired with <attractToGrid/>
The visible pegs and the attraction grid use the same default spacing, so the point softly snaps to each peg as it is dragged near.
Attribute Examples
Attribute Example: dx, dy
The dx and dy attributes set the horizontal and vertical spacing between pegs. Use uneven
spacings when modeling a domain whose axes carry different units.
Attribute Example: xoffset, yoffset
xoffset and yoffset shift the peg lattice so that a peg appears at
(xoffset, yoffset) rather than at the origin.
Property Examples
Property Example: dx, dy, xoffset, yoffset
Each attribute of <pegboard/> is also available as a property of a named pegboard.