ReferenceattractTo

<attractTo>

Attracts a graphical component's position to another component when nearby

<attractTo> is a Graphical component that is used within a <point> to attract it to a specified reference component.

Attributes and Properties

Attributes for <attractTo>

Other (2)
relativeToGraphScales

boolean. Default value: false. Whether the attraction threshold is interpreted relative to the enclosing graph's scales rather than absolute coordinates.

number. Distance within which the position attracts to a target.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <attractTo name="a">

Other (6)
$a.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$a.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$a.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$a.hidden

boolean. Whether this component is hidden from the rendered output.

$a.relativeToGraphScales

boolean. Whether the attraction threshold is interpreted relative to the enclosing graph's scales rather than absolute coordinates.

number. Distance within which the position attracts to a target.

Common to all components (4)
$a.doenetML

text. The DoenetML source code that produced this component.

$a.hide

boolean. Whether to hide this component from the rendered output.

$a.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$a.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Attract a <point> to a <circle>

A <point> is attracted to a named <circle> with a default threshold of attraction of 2%2 \% of the graph axes.


Example: Attract a <point> to an <intersection>

A <point> is attracted to a named <intersection> with a default threshold of attraction of 2%2 \% of the graph axes.


Example: Attract a <point> to a <function> maximum

A <point> is attracted to a named <function> and a named <point> at the function’s maximum with a default threshold of attraction of 2%2 \% of the graph axes.

Attribute Examples

Attribute Example: threshold

The threshold attribute allows customization of the the threshold of attraction.

Property Examples

Property Example: threshold

The threshold property renders the threshold value of the named <attractTo>.