-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc improvements for Hotkey and hotkeyManager, see #1621
- Loading branch information
1 parent
2804d6a
commit 390c8df
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,28 @@ | |
* 1. Added to globalHotkeyRegistry (to be available regardless of keyboard focus) | ||
* 2. Added to a node's inputListeners (to be available only when that node is part of the focused trail) | ||
* | ||
* For example: | ||
* | ||
* globalHotkeyRegistry.add( new Hotkey( { | ||
* key: 'y', | ||
* fire: () => console.log( 'fire: y' ) | ||
* } ) ); | ||
* | ||
* myNode.addInputListener( { | ||
* hotkeys: [ | ||
* new Hotkey( { | ||
* key: 'x', | ||
* fire: () => console.log( 'fire: x' ) | ||
* } ) | ||
* ] | ||
* } ); | ||
* | ||
* Also supports modifier keys that must be pressed in addition to the Key. See options for a description of how | ||
* they behave. | ||
* | ||
* Hotkeys are managed by hotkeyManager, which determines which hotkeys are active based on the globalHotkeyRegistry | ||
* and what Node has focus. See that class for information about how hotkeys work. | ||
* | ||
* @author Jesse Greenberg (PhET Interactive Simulations) | ||
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
@@ -20,8 +42,8 @@ import CallbackTimer from '../../../axon/js/CallbackTimer.js'; | |
export type HotkeyFireOnHoldTiming = 'browser' | 'custom'; | ||
|
||
type SelfOptions = { | ||
// The key that should be pressed to trigger the hotkey (in fireOnDown:true mode) or released to trigger the hotkey (in | ||
// fireOnDown:false mode). | ||
// The key that should be pressed to trigger the hotkey (in fireOnDown:true mode) or released to trigger the hotkey | ||
// (in fireOnDown:false mode). | ||
key: EnglishKey; | ||
|
||
// A set of modifier keys that: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ | |
* The set of enabled hotkeys determines the set of modifier keys that are considered "active" (in addition to | ||
* ctrl/alt/meta/shift, which are always included). | ||
* | ||
* | ||
* @author Jesse Greenberg (PhET Interactive Simulations) | ||
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|