Skip to content

HotkeyData

Under Construction

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

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.

Type HotkeyDataOptions

import type { HotkeyDataOptions } from 'scenerystack/scenery';
  • keyStringProperties: TReadOnlyProperty<OneKeyStroke>[]
    The list of keystrokes that will trigger the hotkey. Wrapping in a Property allows for i18n in the future.
  • keyboardHelpDialogLabelStringProperty?: TReadOnlyProperty<string> | null
    The visual label for this Hotkey in the Keyboard Help dialog. This will also be used as the label in generated documentation, unless binderName is provided.
  • keyboardHelpDialogPDOMLabelStringProperty?: TReadOnlyProperty<string> | string | null
    The PDOM label and description for this Hotkey in the Keyboard Help dialog.
  • repoName: string
    Data for binder (generated documentation).
  • global?: boolean
  • binderName?: string

Source Code

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