|
|
@@ -42,6 +42,7 @@ public class PanAndZoomGestureRecognizer : GestureRecognizer
|
|
|
private float _initialDistance;
|
|
|
private IPointer? _firstContact;
|
|
|
private Point _firstPoint;
|
|
|
+ private Point _initialFirstPoint;
|
|
|
private IPointer? _secondContact;
|
|
|
private Point _secondPoint;
|
|
|
private Point _previousOrigin;
|
|
|
@@ -83,6 +84,14 @@ public class PanAndZoomGestureRecognizer : GestureRecognizer
|
|
|
e.Handled = pinchEventArgs.Handled;
|
|
|
e.PreventGestureRecognition();
|
|
|
}
|
|
|
+ else if(_firstContact != null)
|
|
|
+ {
|
|
|
+ var pinchEventArgs = new PanAndZoomEventArgs(1, _firstPoint, _firstPoint - _initialFirstPoint);
|
|
|
+ _initialFirstPoint = _firstPoint;
|
|
|
+ Target?.RaiseEvent(pinchEventArgs);
|
|
|
+ e.Handled = pinchEventArgs.Handled;
|
|
|
+ e.PreventGestureRecognition();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -94,8 +103,6 @@ public class PanAndZoomGestureRecognizer : GestureRecognizer
|
|
|
{
|
|
|
_firstContact = e.Pointer;
|
|
|
_firstPoint = e.GetPosition(visual);
|
|
|
-
|
|
|
- return;
|
|
|
}
|
|
|
else if (_secondContact == null && _firstContact != e.Pointer)
|
|
|
{
|
|
|
@@ -117,6 +124,12 @@ public class PanAndZoomGestureRecognizer : GestureRecognizer
|
|
|
Capture(_secondContact);
|
|
|
e.PreventGestureRecognition();
|
|
|
}
|
|
|
+ else if(_firstContact != null)
|
|
|
+ {
|
|
|
+ _initialFirstPoint = _firstPoint;
|
|
|
+ Capture(_firstContact);
|
|
|
+ e.PreventGestureRecognition();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -135,11 +148,13 @@ public class PanAndZoomGestureRecognizer : GestureRecognizer
|
|
|
if (_secondContact == pointer)
|
|
|
{
|
|
|
_secondContact = null;
|
|
|
+ _initialFirstPoint = _firstPoint;
|
|
|
}
|
|
|
|
|
|
if (_firstContact == pointer)
|
|
|
{
|
|
|
_firstContact = _secondContact;
|
|
|
+ _initialFirstPoint = _secondPoint;
|
|
|
|
|
|
_secondContact = null;
|
|
|
}
|