diff options
author | darkleem <cdark.lim@samsung.com> | 2017-07-04 11:44:58 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-07-10 11:11:28 +0900 |
commit | 567f8206f527afd9eb26af4aaa8d7cbda944cc95 (patch) | |
tree | ec2d99d1f3798828e5e32f57075863495ac1a398 | |
parent | 2929885b523013a95a1be5b24306aea1386a6cf3 (diff) | |
download | xamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.tar.gz xamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.tar.bz2 xamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.zip |
Fix xamarin gesture in not work
- TASK=TCAPI-2417
Change-Id: I95fc80b20dadbfcd7ee641a1d60d4bf3f4fefca9
Signed-off-by: darkleem <cdark.lim@samsung.com>
-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; } } |