Skip to content

SimDisplay

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/joist/blob/main/js/SimDisplay.ts for the most up-to-date information.

Overview

Wrap the Display class in sim-specific logic. This includes fuzzing support, browser workarounds that have come up over the years, and many listeners added the Display Instance.

@author Sam Reid (PhET Interactive Simulations) @author Chris Malley (PixelZoom, Inc.) @author Jonathan Olson <jonathan.olson@colorado.edu> @author Michael Kauzmann (PhET Interactive Simulations) @author Jesse Greenberg (PhET Interactive Simulations)

Class SimDisplay

import { SimDisplay } from 'scenerystack/sim';

Constructor

new SimDisplay( providedOptions : SimDisplayOptions )

Instance Methods

fuzzInputEvents()

Handle synthetic input event fuzzing

step( dt : number )

getFocusablePlaceholder() : HTMLElement | null

In simulations that do not support Interactive Description or any keyboard-focusable content, the simulation is a black box that cannot even receive browser focus. In some cases, this can be buggy.

For example using global keyboard listeners without any ability to focus in the sim is buggy in iframes: https://github.com/phetsims/circuit-construction-kit-common/issues/1027

This function will return null when the simDisplay is accessible because this element is not needed when there are any other focusable elements in the sim (which is assumed to be true in any simulation PDOM).

Instance Properties

simulationRoot : Node

(readonly)

root for the simulation and the target for AnimatedPanZoomListener to support magnification since the Display rootNode cannot be transformed

Static Properties

DEFAULT_WEBGL

(readonly)

For consistent option defaults

Type SimDisplayOptions

import type { SimDisplayOptions } from 'scenerystack/sim';

Source Code

See the source for SimDisplay.ts in the joist repository.