
Private double _xOffset, _yOffset public double MinScale Private double _startScale, _currentScale I tested it with CarouselView, it works fine on Android. For the 'pinch-to-zoom'function, try the following code. I test the code in a baisc sample and face the same problem as you described.
#Xamarin forms image carousel android
Store the translation delta's of the wrapped user interface element.ĬarouselView and pinchTozoom android slow Apply translation based on the change in origin.Ĭontent.TranslationX = targetX.Clamp(-Content.Width * (currentScale - 1), 0) Ĭontent.TranslationY = targetY.Clamp(-Content.Height * (currentScale - 1), 0) Calculate the transformed element pixel coordinates.ĭouble targetX = xOffset - (originX * Content.Width) * (currentScale - startScale) ĭouble targetY = yOffset - (originY * Content.Height) * (currentScale - startScale) The ScaleOrigin is in relative coordinates to the wrapped user interface element,ĭouble deltaWidth = Width / (Content.Width * startScale) ĭouble originX = (e.ScaleOrigin.X - deltaX) * deltaWidth ĭouble deltaHeight = Height / (Content.Height * startScale) ĭouble originY = (e.ScaleOrigin.Y - deltaY) * deltaHeight Calculate the scale factor to be applied.ĬurrentScale += (e.Scale - 1) * startScale ĬurrentScale = Math.Max(1, currentScale) and zero the components for the center point of the translate transform. Store the current scale factor applied to the wrapped user interface element, Void OnPinchUpdated(object sender, PinchGestureUpdatedEventArgs e)



Var pinchGesture = new PinchGestureRecognizer() Public class PinchToZoomContainer : ContentViewĭouble scaleChange = 0 public PinchToZoomContainer() My code with CarouselView and zoom image execute very well on IOS, but on android stay very slow when i execute zoom.
