Bug 39503 - Pinch Gesture Not Working Well Inside A StackLayout
Summary: Pinch Gesture Not Working Well Inside A StackLayout
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.1.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-03-09 23:55 UTC by Jimmy [MSFT]
Modified: 2016-03-13 23:58 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

repro solution (780.40 KB, application/zip)
2016-03-09 23:55 UTC, Jimmy [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jimmy [MSFT] 2016-03-09 23:55:36 UTC
Created attachment 15342 [details]
repro solution

### Overview
PinchGestures don’t seem to work as well when the element is inside a StackLayout compared to a Grid. You can reproduce the issue using the modified PinchGesture sample that is attached.

The StackLayout seems to decrease the size of the target area for the gesture to be recognized. In my testing, the issue appeared more noticeable on iOS, but I also experienced it on Android

### Steps to Reproduce
1. Run the attached repro project
2. Select the “StackLayout” tab
3. Pinch out to zoom the image. Zoom in quite a bit.
4. Pinch in to zoom out

### Expected Results
The image will zoom out.

### Actual Results
It is difficult to get the container to recognize the pinch gesture to zoom out than it is to zoom in. It feels like there is a small target area that the pinch gesture must begin in for it to be recognized, mostly centered on the screen. So if try to do the gesture near the corners, it doesn’t work. 

This is in contrast to when the container is in a Grid. Then you could pinch anywhere on the screen and the gesture will be recognized and the experience is more fluid. This is demonstrated in the “Grid” and “ContentView” tabs.

### Environment Info
Tested on Forms 2.1
Comment 1 Jason Smith [MSFT] 2016-03-13 23:58:07 UTC
The problem is the way the stacklayout was positioned meaning the PinchToZoomContainer was not consuming the entire page.

var StackPage = new ContentPage
                Title = "StackLayout",
                Content = new StackLayout
                    Padding = new Thickness(0),
                    Children =
                        new PinchToZoomContainer
							VerticalOptions = LayoutOptions.FillAndExpand,
                            Content = new Image
                                Source = ImageSource.FromFile("oasis.jpg"),
                                //WidthRequest = 200,
                                //Aspect = Aspect.AspectFit