Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
PinchGestureUpdatedEventArgs property Scale do not gets correct value.
**Steps to Reproduce:**
1. Add any container like StackLayot
2. Add some Image, set Source property equal to the URI-image
3. Add PinchGestureRecognizer
4. Add Label to represent current Scale value.
5. Run applicaytion and try to "Zoom In"(Pinch).
Scale property getting not correct values:
Scale value should always increase or decrease smoothly.
**Build Date & Platform:**
Video with bug could be found here: https://drive.google.com/file/d/0B1lVIKDv7tWSMFhvMEF4Rm1nR0U/view?usp=sharing
Real case how it could affect Image-zooming functional here:
The PinchGestureUpdatedEventArgs.Scale value is a delta from the last event in the current gesture so it may not change linearly. In order to avoid the jumpiness shown in the video, you can add up the scale values so it continuously increases or decreases while the gesture runs. This is demonstrated in the PinchGestureRecognizer sample here: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/gestures/pinch/
I agree that the documentation for PinchGestureUpdatedEventArgs.Scale does not make this behavior clear so I will raise an issue with the docs team for this.
Hope this helps!
Thank you for your respond.
I've checked and tested the way where I am addinng up the scale values and it does not helps.
I just have outputed scale properties values to ensure that it's bug on Androdid:
- 1.019457 - first pinch step
- 1.021916 - second pinch step.
- 1.020922 - third pinch step.
Could you please explain me where is delta from the last event in current gesture ?
Let's calculate delta from the first and second pinches from my example:
delta = 2nd - 1st
delta = 1.021916 - 1.019457 = 0.002459
Pinch result = 1 - 0.002459 = 0.997541
In my case we have 1.020922 which is not equal to calculated pinch result.
**ALSO PLEASE NOTE**
On iOS platform this Pinch realisation is working fine without jumpiness.
*** Bug 59508 has been marked as a duplicate of this bug. ***
Documentation states that Scale is:
"The distance between the user's digits, divided by the initial distance between the user's digits in the pinch gesture."
There is no indication that this is updated since the last event, as opposed to since the start of the gesture which would be the natural reading of "initial position".
@Valerii - You'd need to multiply scale values to accumulate them.
To make things more confusing, RelScaleTo method, which would be the natural method to use with relative scaling updates, uses 0 as "no change" and negative values to indicate smaller scale, rather than 0-1 for smaller, >1 for larger, which is how ScaleTo works.
@Nicholas I could understand how it works, but just one thing make me confused - why same code working fine on iOS? It's makes me think that it's a bug, because this working different, but should be same. That is the point. How about this?
@Valerii - Sadly I don't have iOS devices so can't confirm that.
Please open a new issue on GitHub with a reproduction project if you are still experiencing the behavior as of the latest stable release of Forms, as we use that for tracking now. Thanks.