You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GestureDetector: ScaleUpdateDetails should also contain a delta since scale is a superset of pan. #43833
If you define both onPanUpdate and onScaleUpdate you get this error:
Incorrect GestureDetector arguments.
I/flutter ( 3574): Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer.
But how? onPanUpdate tells you dx and dy from the last position. While onScaleUpdate tells you focalPoint and localFocalPoint with no initial position. There's no easy way to convert between them.
Or am I missing something?
Frankly, if onScaleUpdate is a superset of onPanUpdate it should contain at least the exact same fields as onPanUpdate.
I believe the assert is not super-honest. There are some things that onPanUpdate provides that's not available from the onScaleUpdate. We should fix that.
/cc @justinmc FYI since you were working on a pan demo.
Yeah I ran into this as well! What I did was to save details.focalPoint in onScaleStart, and then in onScaleUpdate I compare my saved value with the new details.focalPoint and then update the saved value.
That error message above made me think that there was a good reason for excluding dx/dy and my workaround is what we're intended to do. Now that I think about though, I don't know why we don't just include dx/dy as well. I'm on board with that if no one knows of a good reason not to.
Reacted by Marcelo Glasberg, vladimirdjokic76, Arnaud Jezequel, aytunc, Steve, joranmulderij and Anton Burnashev
changed the title [-]Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/-][+]GestureDetector: Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/+]on May 24, 2020
changed the title [-]GestureDetector: Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/-][+]GestureDetector: ScaleUpdateDetails should also contain a delta since scale is a superset of pan.[/+]on Sep 18, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
goderbauer commentedon Oct 30, 2019
I believe the assert is not super-honest. There are some things that onPanUpdate provides that's not available from the onScaleUpdate. We should fix that.
/cc @justinmc FYI since you were working on a pan demo.
justinmc commentedon Oct 31, 2019
Yeah I ran into this as well! What I did was to save
details.focalPointin onScaleStart, and then in onScaleUpdate I compare my saved value with the newdetails.focalPointand then update the saved value.That error message above made me think that there was a good reason for excluding dx/dy and my workaround is what we're intended to do. Now that I think about though, I don't know why we don't just include dx/dy as well. I'm on board with that if no one knows of a good reason not to.
neckaros commentedon Jan 8, 2020
That would be super useful to move things more easily inside a custompaint for exemple!
[-]Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/-][+]GestureDetector: Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/+]markusaksli-nc commentedon Sep 18, 2020
Labeling this as a proposal to add dx/dy to onScaleUpdate rather than adding a workaround example to the docs #43833 (comment)
[-]GestureDetector: Docs should make it clear how to convert ScaleUpdateDetails into PanUpdateDetails[/-][+]GestureDetector: ScaleUpdateDetails should also contain a delta since scale is a superset of pan.[/+]axelthat commentedon Dec 8, 2020
Any update regarding this?
tongclement commentedon Jan 23, 2021
Any update or workarounds? Thanks!
kartik1225 commentedon Apr 23, 2021
Any update?
github-actions commentedon Jul 30, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.