summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkleem <cdark.lim@samsung.com>2017-07-04 02:44:58 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 02:11:28 (GMT)
commit567f8206f527afd9eb26af4aaa8d7cbda944cc95 (patch)
treeec2d99d1f3798828e5e32f57075863495ac1a398
parent2929885b523013a95a1be5b24306aea1386a6cf3 (diff)
downloadxamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.zip
xamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.tar.gz
xamarin-forms-567f8206f527afd9eb26af4aaa8d7cbda944cc95.tar.bz2
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.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/GestureDetector.cs b/Xamarin.Forms.Platform.Tizen/GestureDetector.cs
index bf33809..501b8b4 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;
}
}