Skip to content

HotkeyData

Overview

Data pertaining to a hotkey, including keystrokes and associated metadata for documentation and the keyboard help dialog.

@author Jesse Greenberg (PhET Interactive Simulations)

Class HotkeyData

import { HotkeyData } from 'scenerystack/scenery';

Constructor

new HotkeyData( providedOptions : HotkeyDataOptions )

Instance Methods

hasKeyStroke( keyStroke : OneKeyStroke ) : boolean

Returns true if any of the keyStringProperties of this HotkeyData have the given keyStroke.

serialize() : SerializedHotkeyData

Serialization for usage with binder (generated documentation).

dispose()

Dispose of owned Properties to prevent memory leaks.

Instance Properties

keyStringProperties : TReadOnlyProperty<OneKeyStroke>[]

(readonly)

keyboardHelpDialogLabelStringProperty : TReadOnlyProperty<string> | null

(readonly)

keyboardHelpDialogPDOMLabelStringProperty : TReadOnlyProperty<string> | string | null

(readonly)

keyDescriptorsProperty : TReadOnlyProperty<KeyDescriptor[]>

(readonly)

KeyDescriptors derived from keyStringProperties.

Static Methods

combineKeyStringProperties( hotkeyDataArray : HotkeyData[] ) : TReadOnlyProperty<OneKeyStroke>[]

Combine the keyStringProperties of an array of HotkeyData into a single array. Useful if you want to combine multiple HotkeyData for a single KeyboardListener.

anyHaveKeyStroke( hotkeyDataArray : HotkeyData[], keyStroke : OneKeyStroke ) : boolean

Returns true if any of the HotkeyData in the array have the given keyStroke.

Source Code

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