title | page_title | description | slug | tags | position |
---|---|---|---|---|---|
Touch |
Touch |
The RadSyntaxEditor comes with out-of-the-box support for touch gestures. |
radsyntaxeditor-touch |
touch,radsyntaxeditor |
6 |
The RadSyntaxEditor comes with out-of-the-box support for touch gestures.
When using touch, touch selector markers appear when the user taps on the editor. Swiping 30 pixels around them moves the selection's start/end. Switching to a mouse device hides the markers. The markers are also hidden during a swipe or pinch. Swiping over the line numbers selects each of the lines the swipe passes over.
Gesture | RadSyntaxEditor Action |
---|---|
Tap | Moves the caret under the finger |
Double Tap | Selects the word under the finger |
Pinch | Scales the document (the ScaleFactor changes) |
Swipe | Scrolls the document |
Swipe inertia | Scrolls the document continuously with increased speed |
If you wish to implement your own touch logic, you can override the InitializeTouch method of the RadSyntaxEditor.
{{region cs-radsyntaxeditor-touch-0}}
protected override void InitializeTouch(SyntaxEditorPresenter presenter)
{
TouchManager.AddSwipeEventHandler(presenter, new SwipeEventHandler(OnSwipe));
base.InitializeTouch(presenter);
}
private void OnSwipe(object sender, SwipeEventArgs args)
{
// your custom logic for swiping
args.Handled = true; // you can omit this if your custom logic does not contradict with the default logic
}
{{endregion}}
You can read the [following article]({%slug touchmanager-events%}) article, which describes all of the events exposed by the TouchManager.
By default, dragging the markers is possible if the swipe occurs up to 30 pixels from their center. This area can be controlled via the TouchMarkerDragDistance property of the RadSyntaxEditor control.
{{region cs-radsyntaxeditor-touch-1}}
this.syntaxEditor.TouchMarkerDragDistance = 40;
{{endregion}}
- [Events]({%slug radsyntaxeditor-events%})
- [Commands]({%slug radsyntaxeditor-commands%})