Skip to content

GestureDetector: ScaleUpdateDetails should also contain a delta since scale is a superset of pan. #43833

Closed

Description

@marcglasberg

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.

Activity

  1. added
    a: qualityA truly polished experience
    d: api docsIssues with https://api.flutter.dev/
    f: gesturesflutter/packages/flutter/gestures repository.
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Oct 30, 2019
  2. added this to the milestone on Oct 30, 2019
  3. goderbauer commented on Oct 30, 2019

    @goderbauer
    Member

    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.

  4. justinmc commented on Oct 31, 2019

    @justinmc
    Contributor

    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.

  5. neckaros commented on Jan 8, 2020

    @neckaros

    That would be super useful to move things more easily inside a custompaint for exemple!

  6. 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
  7. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  8. removed this from the milestone on Aug 17, 2020
  9. markusaksli-nc commented on Sep 18, 2020

    @markusaksli-nc
    Contributor

    Labeling this as a proposal to add dx/dy to onScaleUpdate rather than adding a workaround example to the docs #43833 (comment)

  10. 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
  11. axelthat commented on Dec 8, 2020

    @axelthat

    Any update regarding this?

  12. tongclement commented on Jan 23, 2021

    @tongclement

    Any update or workarounds? Thanks!

  13. kartik1225 commented on Apr 23, 2021

    @kartik1225
    Contributor

    Any update?

  14. github-actions commented on Jul 30, 2021

    @github-actions

    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.

  15. locked as resolved and limited conversation to collaborators on Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: qualityA truly polished experiencec: proposalA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions