Provides implementation singletons and utility methods for event recognizers.
Remarks
EventRecognizers are convertible: strings like "TOUCH_DOWN_PRIMARY || (LEFT_DOWN && SHIFT_IS_DOWN)"
are automatically converted to recognizer functions when used in parameter lists, parameter objects, or setters.
Valid EventRecognizer strings follow this grammar:
EXPR = RECOGNIZER
| '(' EXPR ')'
| '!' EXPR
| EXPR '&&' EXPR
| EXPR '||' EXPR
Whitespace is ignored and RECOGNIZER
is one of the EventRecognizer constants defined in MouseEventRecognizers, KeyEventRecognizers, or TouchEventRecognizers. The operators work mostly as in JavaScript. &&
and ||
have the same operator precedence, though. This means that, e.g., A || B && C
is - unlike JavaScript - bracketed (A || B) && C
and not A || (B && C)
.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.EventRecognizers
See Also
Constants
An event recognizer that will always return true;
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
See Also
An event recognizer that will always return false;
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
See Also
Static Methods
createAndRecognizer
(recognizers: function(Object, EventArgs):boolean…) : function(any, EventArgs):booleanCreates an instance that is the logical 'and' combination of the provided recognizers.
Parameters
A map of options to pass to the method.
- recognizers - function(Object, EventArgs):boolean
- The recognizers to perform the logical operation on.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Returns
- ↪function(any, EventArgs):boolean
- An instance that is the result of the logical 'and' operation of the provided instances.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
createOrRecognizer
(recognizers: function(Object, EventArgs):boolean…) : function(any, EventArgs):booleanCreates an instance that is the logical 'or' combination of the provided recognizers.
Parameters
A map of options to pass to the method.
- recognizers - function(Object, EventArgs):boolean
- The recognizers to perform the logical operation on.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Returns
- ↪function(any, EventArgs):boolean
- An instance that is the result of the logical 'or' operation of the provided instances.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Creates an event recognizer instance that yields the boolean inverse of the given event recognizer.
Parameters
A map of options to pass to the method.
- recognizer - function(Object, EventArgs):boolean
- The recognizer to invert.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Returns
- ↪function(any, EventArgs):boolean
- An implementation that performs the logical negation for the argument.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Examples
const moveInputMode = graphEditorInputMode.moveInputMode
moveInputMode.hoverRecognizer = EventRecognizers.createAndRecognizer(
MouseEventRecognizers.LEFT_IS_DOWN,
(sender, args) => !KeyEventRecognizers.SHIFT_IS_DOWN(sender, args)
)