Skip to content

HighlightFromNode

Overview

A HighlightPath subtype that is based around a Node. The focusHighlight is constructed based on the bounds of the node. The focusHighlight will update as the Node's bounds changes. Handles transformations so that when the source node is transformed, the HighlightFromNode will updated be as well.

@author Michael Kauzmann (PhET Interactive Simulations) @author Jesse Greenberg (PhET Interactive Simulations)

Class HighlightFromNode

import { HighlightFromNode } from 'scenerystack/scenery';

Constructor

new HighlightFromNode( node : Node | null, providedOptions? : HighlightFromNodeOptions )

Instance Methods

setShapeFromNode( node : Node, trail? : Trail )

Update the focusHighlight shape on the path given the node passed in. Depending on options supplied to this HighlightFromNode, the shape will surround the node's bounds or its local bounds, dilated by an amount that is dependent on whether or not this highlight is for group content or for the node itself. See ParallelDOM.setGroupFocusHighlight() for more information on group highlights.

node - The Node with a highlight to surround. [trail] - A Trail to use to describe the Node in the global coordinate frame. Provided by the HighlightOverlay, to support DAG.

dispose()

Remove the listener from the observedBoundsProperty (which belongs to a provided Node).

Type HighlightFromNodeOptions

The transformSourceNode for this highlight will be the provided Node.

import type { HighlightFromNodeOptions } from 'scenerystack/scenery';
  • useLocalBounds?: boolean
    if true, highlight will surround local bounds instead of parent bounds
  • dilationCoefficient?: number | null
    default value is function of node transform (minus translation), but can be set explicitly. see HighlightPath.getDilationCoefficient(). A number here refers to the amount in global coordinates to dilate the focus highlight.
  • useGroupDilation?: boolean
    if true, dilation for bounds around node will increase, see setShapeFromNode()
  • & StrictOmit<HighlightPathOptions, "transformSourceNode">

Source Code

See the source for HighlightFromNode.ts in the scenery repository.