Skip to content

Key

Overview

key object, intended for use in the PhET common-code keypad

@author Aadish Gupta @author John Blanco

Class Key

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

Constructor

new Key( label : Node | string, identifier : KeyIDValue, providedOptions? : KeyOptions )

Instance Methods

Instance Properties

horizontalSpan : number

(readonly)

number of horizontal cells in the keypad grid that this key occupies

verticalSpan : number

(readonly)

number of vertical cells in the keypad grid that this key occupies

buttonTandemName : string

(readonly)

The tandem component name to use when creating a button from this key.

keyboardIdentifiers : OneKeyStroke[]

(readonly)

For keyboard input, this is used to identify the keystroke to activate this key (see KeyboardListener.ts)

Type KeyOptions

import type { KeyOptions } from 'scenerystack/scenery-phet';
  • horizontalSpan?: number
  • verticalSpan?: number
  • keyboardIdentifiers?: OneKeyStroke[]

Source Code

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