public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { if (_pointer2 != null && touches.Contains(_pointer2)) { CGPoint screenPos1 = _pointer1.LocationInView(this); CGPoint screenPos2 = _pointer2.LocationInView(this); _baseMapView.OnInputEvent(NativeActionPointer2Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale); _pointer2 = null; } if (_pointer1 != null && touches.Contains(_pointer1)) { CGPoint screenPos1 = _pointer1.LocationInView(this); if (_pointer2 != null) { CGPoint screenPos2 = _pointer2.LocationInView(this); _baseMapView.OnInputEvent(NativeActionPointer1Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale); _pointer1 = _pointer2; _pointer2 = null; } else { _baseMapView.OnInputEvent(NativeActionPointer1Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate); _pointer1 = null; } } }
public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { // Note: should use ACTION_CANCEL here, but Xamarin.Forms uses this // for single clicks, so we need to emulate TouchesEnded here actually if (_pointer2 != null && touches.Contains(_pointer2)) { if (_pointer1 != null && !touches.Contains(_pointer1)) { CGPoint screenPos1 = _pointer1.LocationInView(this); _baseMapView.OnInputEvent(NativeActionPointer2Up, (float)screenPos1.X * _scale, (float)screenPos1.Y * _scale, NativeNoCoordinate, NativeNoCoordinate); } else { _baseMapView.OnInputEvent(NativeActionPointer2Up, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate); } _pointer2 = null; } if (_pointer1 != null && touches.Contains(_pointer1)) { if (_pointer2 != null) { CGPoint screenPos2 = _pointer2.LocationInView(this); _baseMapView.OnInputEvent(NativeActionPointer1Up, NativeNoCoordinate, NativeNoCoordinate, (float)screenPos2.X * _scale, (float)screenPos2.Y * _scale); _pointer1 = _pointer2; _pointer2 = null; } else { _baseMapView.OnInputEvent(NativeActionPointer1Up, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate, NativeNoCoordinate); _pointer1 = null; } } }