From cb19df8371a48d3a91c8d70f35e3f62f1876b335 Mon Sep 17 00:00:00 2001 From: darkleem Date: Tue, 4 Jul 2017 11:44:58 +0900 Subject: Fix xamarin gesture in not work - TASK=TCAPI-2417 Change-Id: I95fc80b20dadbfcd7ee641a1d60d4bf3f4fefca9 Signed-off-by: darkleem --- Xamarin.Forms.Platform.Tizen/GestureDetector.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Xamarin.Forms.Platform.Tizen') diff --git a/Xamarin.Forms.Platform.Tizen/GestureDetector.cs b/Xamarin.Forms.Platform.Tizen/GestureDetector.cs index bf33809a..501b8b45 100644 --- a/Xamarin.Forms.Platform.Tizen/GestureDetector.cs +++ b/Xamarin.Forms.Platform.Tizen/GestureDetector.cs @@ -41,6 +41,7 @@ namespace Xamarin.Forms.Platform.Tizen { // this will clear all callbacks in ElmSharp GestureLayer _gestureLayer.Unrealize(); + _gestureLayer = null; foreach (var handlers in _handlerCache.Values) { foreach (var handler in handlers) @@ -50,14 +51,19 @@ namespace Xamarin.Forms.Platform.Tizen } _handlerCache.Clear(); - (View.GestureRecognizers as ObservableCollection).CollectionChanged -= OnGestureRecognizerCollectionChanged; if (_hitBox != null) { + _renderer.NativeView.Moved -= OnMoveToHitbox; _hitBox.Unrealize(); _hitBox = null; } } + void OnMoveToHitbox(object sender, EventArgs e) + { + UpdateHitBox(); + } + public void UpdateHitBox() { if (_hitBox == null) @@ -142,7 +148,7 @@ namespace Xamarin.Forms.Platform.Tizen break; case EGestureType.Line: - AddPanGesture(gestureType); + AddLineGesture(gestureType); break; case EGestureType.Flick: @@ -188,7 +194,7 @@ namespace Xamarin.Forms.Platform.Tizen break; case EGestureType.Line: - RemovePanGesture(); + RemoveLineGesture(); break; case EGestureType.Flick: @@ -222,6 +228,7 @@ namespace Xamarin.Forms.Platform.Tizen { Color = EColor.Transparent }; + _renderer.NativeView.Moved += OnMoveToHitbox; _hitBox.Show(); UpdateHitBox(); parent.PackAfter(_hitBox, _renderer.NativeView); @@ -229,7 +236,7 @@ namespace Xamarin.Forms.Platform.Tizen } } - void AddPanGesture(EGestureType type) + void AddLineGesture(EGestureType type) { EnsureHitBoxExists(); _gestureLayer.SetLineCallback(GestureLayer.GestureState.Start, (data) => { OnGestureStarted(type, data); }); @@ -303,7 +310,7 @@ namespace Xamarin.Forms.Platform.Tizen _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Abort, (data) => { OnGestureCanceled(type, data); }); } - void RemovePanGesture() + void RemoveLineGesture() { _gestureLayer.SetLineCallback(GestureLayer.GestureState.Start, null); _gestureLayer.SetLineCallback(GestureLayer.GestureState.Move, null); @@ -570,7 +577,7 @@ namespace Xamarin.Forms.Platform.Tizen break; case NotifyCollectionChangedAction.Reset: - RemoveGestures(View.GestureRecognizers); + Clear(); break; } } -- cgit v1.2.3