Skip to content

TransformTracker

Overview

Used for identifying when any ancestor transform of a node in a trail causes that node's global transform to change. It also provides fast computation of that global matrix, NOT recomputing every matrix, even on most transform changes.

@author Jonathan Olson <jonathan.olson@colorado.edu> @author Jesse Greenberg

Class TransformTracker

import { TransformTracker } from 'scenerystack/scenery';

Constructor

new TransformTracker( trail : Trail, providedOptions? : TransformTrackerOptions )

Instance Methods

dispose()

Gets rid of all external references and listeners. This object is inoperable afterwards.

addListener( listener : () => void )

Adds a listener function that will be synchronously called whenever the transform for this Trail changes.

removeListener( listener : () => void )

Removes a listener that was previously added with addListener().

getMatrix() : Matrix3

Returns the local-to-global transformation matrix for the Trail, which transforms its leaf node's local coordinate frame into the global coordinate frame.

NOTE: The matrix returned should not be mutated. Please make a copy if needed.

Type TransformTrackerOptions

import type { TransformTrackerOptions } from 'scenerystack/scenery';
  • isStatic?: boolean
    Whether the bounds listeners should be added with on() or onStatic().

Source Code

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