Touch handling
GraphEditorInputMode and GraphViewerInputMode allow convenient handling of tap gestures on items. Both single and double taps are reported in a similar manner as mouse clicks. Note that a tap or double tap will raise the same events as a mouse click or double click. Also, property clickableItems specifies the graph item types for which a tap is reported as well. The dispatched events are listed in the table below:
Event | Occurs when … |
---|---|
In most cases handling click events only will suffice. If you need complete control over what happens on clicks within GraphEditorInputMode or GraphViewerInputMode you can override the tap method which handles all the default actions, such as raising click events, propagating them to items that are at the tapped location and also handling default actions, such as selection and focus.
Defining the items for which taps are reported as well as defining the hit test order can be achieved using the same properties as for mouse clicks. Please refer to the according section.
The actual tap handling is delegated to GraphEditorInputMode’s and GraphViewerInputMode’s child input mode TapInputMode. Both listen for ClickInputMode’s Tapped and DoubleTapped events to handle taps and double taps.
Event | Occurs when … |
---|---|
You may want to listen for these events, if GraphEditorInputMode’s or GraphViewerInputMode’s item click events are not applicable for your use case.
TapInputMode provides a number of properties to further customize tap handling:
- validTapHitTestable
- Allows to restrict the area where taps should be recognized. By default the area is unrestricted.
- swallowFocusTap
- Whether taps should be discarded if they occur within 100ms after the canvas got the focus. By default this is disabled.