-
Notifications
You must be signed in to change notification settings - Fork 2
InputTrigger syntax
ui-behaviour is a library for binding behaviours by keys or mouse-actions. The idea is similar to Swing's InputMap/ActionMap framework. The difference is that actions are atomic while behaviours (possibly) stretch over a period of time. For example, a DragBehaviour is initialized (e.g., with a mouse click) at certain coordinates, goes through a series of coordinate updates, and then ends (when the mouse is released).
The combination of modifiers, keys, mouse buttons etc. that initiates a behaviour is called a "trigger" and is constructed from a string description.
The basic syntax for a trigger description is a sequence of modifier and key names separated by whitespace.
Examples are SPACE, button1, shift alt scroll, and ctrl F G.
Additionally, one can specify a combination of modifiers, keys, mouse buttons etc. that should be ignored when triggering the behaviour. This is a another sequence of modifier and key names separated from the trigger description by "|". For example, ctrl button1 | shift alt is triggered by pressing the left mouse-button while holding the ctrl key. If the shift and/or alt key are pressed simultaneously, the trigger still matches. To ignore all other modifiers and keys, the special name all is used. So, A | all is a trigger that matches when the A key is pressed, regardless which other modifiers, keys, or buttons are active at the same time.
The following modifiers can be used:
ctrlaltaltGraphshiftmeta-
win(the windows key) -
double-click(The trigger matches a double-click. This can include "double-clicks" on keys, e.g.,shift double-click Aworks as expected.)
-
button1(left mouse button) -
button2(middle mouse button) -
button3(right mouse button) -
scroll(The trigger matches scroll events (both horizontal and vertical). Additional keys and modifiers may be present, e.g.,shift A scrollmatches when scrolling while pressing theshiftandAkeys. This modifier can only be used to triggerScrollBehaviours.)
Key names are the usual alphanumeric and function keys:
-
A...Z(Note that letter keys are always upper-case.) -
0...9 -
F1...F24
Moreover the following special key names are supported (as in the AWTKeyStroke.getAWTKeyStroke(String) method):
ENTERBACK_SPACETABCANCELCLEARCOMPOSEPAUSECAPS_LOCKESCAPESPACEPAGE_UPPAGE_DOWNENDHOMEBEGINCOMMAPERIODSLASHSEMICOLONEQUALSOPEN_BRACKETBACK_SLASHCLOSE_BRACKET
These are names for cursor keys:
LEFTUPRIGHTDOWN
These are names for the numpad keys:
-
NUMPAD0...NUMPAD9 MULTIPLYADDSEPARATORSUBTRACTDECIMALDIVIDEDELETENUM_LOCKSCROLL_LOCK