partial void ChangeViewScroll(double?horizontalOffset, double?verticalOffset, bool disableAnimation) { if (_scrollableContainer != null) { // iOS doesn't limit the offset to the scrollable bounds by itself var point = new CGPoint(horizontalOffset ?? HorizontalOffset, verticalOffset ?? VerticalOffset); var newOffset = point.Clamp(CGPoint.Empty, _scrollableContainer.UpperScrollLimit); _scrollableContainer.SetContentOffset(newOffset, !disableAnimation); } }
private bool ChangeViewScrollNative(double?horizontalOffset, double?verticalOffset, float?zoomFactor, bool disableAnimation) { if (_scrollableContainer != null) { // iOS doesn't limit the offset to the scrollable bounds by itself var point = new CGPoint(horizontalOffset ?? HorizontalOffset, verticalOffset ?? VerticalOffset); var newOffset = point.Clamp(CGPoint.Empty, _scrollableContainer.UpperScrollLimit); _scrollableContainer.SetContentOffset(newOffset, !disableAnimation); if (zoomFactor is { } zoom) { ChangeViewZoom(zoom, disableAnimation); } // Return true if successfully scrolled to asked offsets return((horizontalOffset == null || horizontalOffset == newOffset.X) && (verticalOffset == null || verticalOffset == newOffset.Y)); } return(false); }