diff options
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/GestureDetector.cs | 19 |
1 files changed, 13 insertions, 6 deletions
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<IGestureRecognizer>).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; } } |