<stickyGroup>
<stickyGroup> is a Graphical
component that groups other graphical objects (typically <polygon>s, <polyline>s, and
<point>s) so they snap to each other when their vertices or edges are nearby. Vertices snap
together within threshold distance, and edges of rigid polygons can rotate to align with
neighboring edges within angleThreshold radians.
Children of a <stickyGroup> are rendered exactly as they would be outside it; only the dragging
behavior is changed.
Attributes and Properties
Attributes for <stickyGroup>
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Other (5)
number. Default value: 0.09424777960769379. Angular distance within which group members snap together.
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
layerinteger. Default value: 0. Z-order layer index used to stack graphical components (higher values render on top).
boolean. Default value: false. Whether the snapping threshold is interpreted relative to graph scales.
number. Distance threshold within which group members snap together.
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 <stickyGroup name="s">
Labels (2)
$s.labellabel. The label rendered with this component.
$s.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (10)
$s.angleThresholdnumber. Angular distance within which group members snap together.
$s.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$s.disabledboolean. Whether this component is disabled and cannot be interacted with.
$s.fixedboolean. Whether this component's value is fixed and cannot be modified.
$s.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$s.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$s.relativeToGraphScalesboolean. Whether the snapping threshold is interpreted relative to graph scales.
$s.scalesnumber. The graph axis scales (x and y) used when applying this constraint.
$s.thresholdnumber. Distance within which group members attract each other.
Common to all components (4)
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$s.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Two polygons that snap together
Drag either polygon close to the other. When a vertex or edge comes within the default snap threshold, the polygon snaps so the matching vertices coincide or the edges align.
Example: Snapping a point to a polygon
When dragged close enough, the point first attracts to a triangle vertex, and otherwise to the nearest point on a triangle edge.
Attribute Examples
Attribute Example: threshold
threshold controls how close vertices or edges must be (in graph units) before they snap. The
default is , or when relativeToGraphScales is set.
Attribute Example: angleThreshold
angleThreshold (in radians) sets how close two rigid polygon edges must already be in orientation
before they rotate to align. The default is roughly rad (about ); increasing it makes
edges snap together over a wider range of angles.
Attribute Example: relativeToGraphScales
When the and axes use very different scales, relativeToGraphScales measures snap distances
relative to the axis scales rather than as raw mathematical distances. This keeps the snap behavior
matching what the user sees on screen.
Property Examples
Property Example: threshold
The threshold attribute is also available as a property of a named <stickyGroup>.