Skip to content

KeyboardHelpIconFactory

Overview

Reusable icons to be created for keyboard help shortcuts dialogs. This type is only a collection of static methods, and should not be instantiated.

@author Michael Kauzmann (PhET Interactive Simulations)

Class KeyboardHelpIconFactory

import { KeyboardHelpIconFactory } from 'scenerystack/scenery-phet';

Constructor

new KeyboardHelpIconFactory()

Instance Methods

Static Methods

iconRow( icons : Node[], providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

Horizontal layout of a set of icons, in left-to-right order.

iconOrIcon( leftIcon : Node, rightIcon : Node, providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

Two icons with horizontal layout, separated by 'or' text.

iconToIcon( leftIcon : Node, rightIcon : Node, providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

Two icons with horizontal layout, and separated by '-' text. This is useful for a range, like 0-9.

iconPlusIcon( leftIcon : Node, rightIcon : Node, providedOptions? : WithPlusIconOptions ) : Node

Two icons with horizontal layout, separated by '+' text.

iconPlusIconRow( iconList : Node[], providedOptions? : WithPlusIconOptions ) : Node

Returns a row of icons separated by '+'. Useful when a keyboard shortcut has multiple modifier keys for one key press listener.

shiftPlusIcon( icon : Node, providedOptions? : WithPlusIconOptions ) : Node

An icon with horizontal layout in order: shift, plus, and provided icon.

altPlusIcon( icon : Node, providedOptions? : WithPlusIconOptions ) : Node

An icon with horizontal layout in order: alt, plus, and provided icon.

spaceOrEnter() : Node

"Space or Enter" icon

upOrDown() : Node

An icon with up and down arrows, separated by 'or', in horizontal layout.

wasdRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with up and down arrow keys, in a horizontal layout.

arrowKeysRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with the 4 arrow keys, in a horizontal layout.

arrowOrWasdKeysRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with the 4 arrow keys, WASD keys, separated by "or", in horizontal layout.

pageUpPageDownRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with page up/down keys, in horizontal layout.

upDownArrowKeysRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with up and down arrow keys, in horizontal layout.

leftRightArrowKeysRowIcon( providedOptions? : KeyboardHelpIconFactoryOptions ) : Node

An icon with left and right arrow keys, in horizontal layout.

fromHotkeyData( hotkeyData : HotkeyData ) : Node

Create an icon Node for a hotkey, based on the provided HotkeyData. Combines key icons with plus icons. For example, a HotkeyData with 'shift+r' would produce a row with the shift icon, a plus icon, and the r icon.

Static Properties

DEFAULT_ICON_SPACING

(readonly)

ENGLISH_KEY_TO_KEY_NODE : Map

(readonly)

Maps English key strings to their corresponding icon nodes.

Source Code

See the source for KeyboardHelpIconFactory.ts in the scenery-phet repository.