Add double click recognizer

This commit is contained in:
Frank A. Krueger 2017-12-09 22:46:27 -08:00
parent 4f047d1e85
commit 72af1a8a3a
1 changed files with 16 additions and 1 deletions

View File

@ -119,7 +119,7 @@ namespace Ooui.Forms
var weakEventTracker = new WeakReference (this); var weakEventTracker = new WeakReference (this);
var tapRecognizer = recognizer as TapGestureRecognizer; var tapRecognizer = recognizer as TapGestureRecognizer;
if (tapRecognizer != null) { if (tapRecognizer != null && tapRecognizer.NumberOfTapsRequired == 1) {
var returnAction = new TargetEventHandler ((s, e) => { var returnAction = new TargetEventHandler ((s, e) => {
var tapGestureRecognizer = weakRecognizer.Target as TapGestureRecognizer; var tapGestureRecognizer = weakRecognizer.Target as TapGestureRecognizer;
var eventTracker = weakEventTracker.Target as EventTracker; var eventTracker = weakEventTracker.Target as EventTracker;
@ -134,6 +134,21 @@ namespace Ooui.Forms
}; };
return uiRecognizer; return uiRecognizer;
} }
if (tapRecognizer != null && tapRecognizer.NumberOfTapsRequired == 2) {
var returnAction = new TargetEventHandler ((s, e) => {
var tapGestureRecognizer = weakRecognizer.Target as TapGestureRecognizer;
var eventTracker = weakEventTracker.Target as EventTracker;
var view = eventTracker?._renderer?.Element as View;
if (tapGestureRecognizer != null && view != null)
tapGestureRecognizer.SendTapped (view);
});
var uiRecognizer = new NativeGestureRecognizer {
EventType = "dblclick",
Handler = returnAction,
};
return uiRecognizer;
}
return null; return null;
} }