-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Draggable feedback positioning #145647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draggable feedback positioning #145647
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
From triage: @timcreatedit looks like this is failing some checks. Could you take a look? It also appears to be missing a test. Could you please add one? Thank you! |
|
I will take a look, yes! I'll add a test for the behaviour, I wasn't sure if that's desired since the class I touched seems to be untested. |
a6b4ea1 to
34f6e2a
Compare
|
Looks like there are still some failures. Some of them look related to this change, e.g. https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752209309943481745/+/u/run_test.dart_for_framework_tests_shard_and_subshard_widgets/stdout |
|
I can reproduce the test failures in test/widgets/draggable_test.dart, but I'm unsure where they come from. I'm investigating |
|
I think I have found the issue, however, I don't really understand why this change triggered the failures. Some tests in Adding the following lines to the end of these tests resolves all test failures: // Finish gesture to release resources.
await gesture.up();
await tester.pump();Finishing gestures like this seems to be common practice anyways, and is done in many other tests within the same file. |
|
@goderbauer is there anything I should still do before this can be reviewed? |
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit and a question.
Thanks for fixing this, I was just noticing another place where we weren't doing transforms properly (#146019).
| _lastOffset = globalPosition - dragStartPoint; | ||
| final RenderBox box = overlayState.context.findRenderObject()! as RenderBox; | ||
| final Offset overlaySpaceOffset = box.globalToLocal(globalPosition); | ||
| _overlayOffset = overlaySpaceOffset - dragStartPoint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems weird to me that we're subtracting dragStartPoint both from a point in global space (_lastOffset = globalPosition - dragStartPoint;) and from a point in local/overlay space (_overlayOffset = overlaySpaceOffset - dragStartPoint;). Wouldn't it be in the wrong coordinate space in one of those operations?
I guess based on your test and your video demo it works, though, so maybe I'm misunderstanding what dragStartPoint is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same question at first. This transformation is definitely correct for the purposes of _overlayOffset and I've added another test to verify that. However, it might be incorrect for _lastOffset, which we purposefully haven't touched. We wanted this PR to focus on the visual feedback only, since we thought that would be least likely to break existing Flutter code. Adjusting _lastOffset_ can be done in another PR, where we could then make sure all Draggable callbacks use the Overlay space instead of global coordinates as they do now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sounds good. I agree that it looks like dragStartPoint is not in the same coordinate space as globalPosition, but _overlayOffset should be right.
…e-it/flutter into draggable-feedback-positioning
|
Reason for revert: Failing draggable_test in post-submit. |
|
This reverts commit 5f9e069.
Reverts: #145647 Initiated by: jmagman Reason for reverting: Failing draggable_test in post-submit. Original PR Author: timcreatedit Reviewed By: {justinmc, goderbauer} This change reverts the following previous change: We changed the coordinates used to position the `Draggable` feedback by transforming them into the `Overlay`s coordinate space. This has no influence on any untransformed `Overlay`, most Flutter apps should be not affected. This PR fixes the positioning of the feedback in transformed context (see #145639 for before video): https://github.com/flutter/flutter/assets/42270125/df34e198-0667-453d-a27a-a79b2e2825a1 - fixes #145639
Roll Flutter from d33bb8f to bf7191f (34 revisions) flutter/flutter@d33bb8f...bf7191f 2024-05-02 [email protected] Roll Flutter Engine from b989d239e281 to 1fb36ac9d718 (2 revisions) (flutter/flutter#147713) 2024-05-02 [email protected] Roll Flutter Engine from 3c9c2ce8369e to b989d239e281 (1 revision) (flutter/flutter#147711) 2024-05-02 [email protected] Roll Flutter Engine from 58b031c096ea to 3c9c2ce8369e (2 revisions) (flutter/flutter#147703) 2024-05-02 [email protected] Roll Flutter Engine from fc28057dbd4d to 58b031c096ea (1 revision) (flutter/flutter#147701) 2024-05-02 [email protected] Roll Flutter Engine from bfc6787eedc3 to fc28057dbd4d (1 revision) (flutter/flutter#147700) 2024-05-02 [email protected] Roll Flutter Engine from 7cbef71f4f54 to bfc6787eedc3 (1 revision) (flutter/flutter#147699) 2024-05-02 [email protected] Roll Flutter Engine from 90ce9e5959fc to 7cbef71f4f54 (1 revision) (flutter/flutter#147696) 2024-05-02 [email protected] Roll Flutter Engine from 78dced50c467 to 90ce9e5959fc (1 revision) (flutter/flutter#147695) 2024-05-02 [email protected] add verbose logging to select hot reload/hot restart tests (flutter/flutter#147673) 2024-05-02 [email protected] Roll Flutter Engine from 3087ec1adddd to 78dced50c467 (3 revisions) (flutter/flutter#147693) 2024-05-02 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Implement computeDryBaseline for `RenderWrap` (#146260)" (flutter/flutter#147692) 2024-05-02 [email protected] Roll Flutter Engine from f56c20c6ac67 to 3087ec1adddd (2 revisions) (flutter/flutter#147688) 2024-05-02 [email protected] Allow explicit exclusion of packages from pinned packages in `flutter update-packages --force-update` (flutter/flutter#147679) 2024-05-02 [email protected] Implement getDryBaseline for Stack and Overlay (flutter/flutter#146253) 2024-05-02 [email protected] Roll Flutter Engine from 2d73fa207927 to f56c20c6ac67 (2 revisions) (flutter/flutter#147681) 2024-05-02 [email protected] Update selectable_text_test.dart (flutter/flutter#147677) 2024-05-01 [email protected] Roll Flutter Engine from c536a14052e5 to 2d73fa207927 (2 revisions) (flutter/flutter#147678) 2024-05-01 [email protected] Implement computeDryBaseline for `RenderWrap` (flutter/flutter#146260) 2024-05-01 [email protected] Roll Flutter Engine from 842cf254ec58 to c536a14052e5 (1 revision) (flutter/flutter#147675) 2024-05-01 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.3.0 to 4.3.1 (flutter/flutter#147674) 2024-05-01 [email protected] Remove obsolete performance analysis tools. (flutter/flutter#147663) 2024-05-01 [email protected] Roll Flutter Engine from 5129b4919434 to 842cf254ec58 (3 revisions) (flutter/flutter#147670) 2024-05-01 [email protected] fix DropdownMenu overflow (flutter/flutter#147233) 2024-05-01 [email protected] [web] remove platform_messages_integration test (flutter/flutter#147654) 2024-05-01 [email protected] Fix `TextField` horizontal drag conflicts (flutter/flutter#147341) 2024-05-01 [email protected] `flutter/lib/src/`: refactoring if-chains into switch expressions (flutter/flutter#147472) 2024-05-01 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Draggable feedback positioning (#145647)" (flutter/flutter#147658) 2024-05-01 [email protected] Roll Flutter Engine from 0014e0353aa9 to 5129b4919434 (1 revision) (flutter/flutter#147655) 2024-05-01 [email protected] add lang attribute to the a11y_assessments app (flutter/flutter#147586) 2024-05-01 [email protected] Draggable feedback positioning (flutter/flutter#145647) 2024-05-01 [email protected] Roll Flutter Engine from 0ce67714ce4c to 0014e0353aa9 (13 revisions) (flutter/flutter#147649) 2024-05-01 [email protected] Add test for animated_fractionally_sized_box.0.dart API example. (flutter/flutter#146721) 2024-05-01 [email protected] Roll Packages from cc47b06 to aea93d2 (5 revisions) (flutter/flutter#147647) 2024-05-01 [email protected] Update reorderable_list.dart to use Dart 3 return switch statement for consistency (flutter/flutter#147505) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 ...
|
@timcreatedit It looks like that's not a test you touched directly. Is it related to the |
|
@justinmc I took a look and it seems like this happened because gestures are not correctly ended in other tests that ran before this one. Again, the failed test passes when ran in isolation. I really don't understand why these failures are only on this branch, can anybody help me out? |
Roll Flutter from d33bb8f to bf7191f (34 revisions) flutter/flutter@d33bb8f...bf7191f 2024-05-02 [email protected] Roll Flutter Engine from b989d239e281 to 1fb36ac9d718 (2 revisions) (flutter/flutter#147713) 2024-05-02 [email protected] Roll Flutter Engine from 3c9c2ce8369e to b989d239e281 (1 revision) (flutter/flutter#147711) 2024-05-02 [email protected] Roll Flutter Engine from 58b031c096ea to 3c9c2ce8369e (2 revisions) (flutter/flutter#147703) 2024-05-02 [email protected] Roll Flutter Engine from fc28057dbd4d to 58b031c096ea (1 revision) (flutter/flutter#147701) 2024-05-02 [email protected] Roll Flutter Engine from bfc6787eedc3 to fc28057dbd4d (1 revision) (flutter/flutter#147700) 2024-05-02 [email protected] Roll Flutter Engine from 7cbef71f4f54 to bfc6787eedc3 (1 revision) (flutter/flutter#147699) 2024-05-02 [email protected] Roll Flutter Engine from 90ce9e5959fc to 7cbef71f4f54 (1 revision) (flutter/flutter#147696) 2024-05-02 [email protected] Roll Flutter Engine from 78dced50c467 to 90ce9e5959fc (1 revision) (flutter/flutter#147695) 2024-05-02 [email protected] add verbose logging to select hot reload/hot restart tests (flutter/flutter#147673) 2024-05-02 [email protected] Roll Flutter Engine from 3087ec1adddd to 78dced50c467 (3 revisions) (flutter/flutter#147693) 2024-05-02 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Implement computeDryBaseline for `RenderWrap` (#146260)" (flutter/flutter#147692) 2024-05-02 [email protected] Roll Flutter Engine from f56c20c6ac67 to 3087ec1adddd (2 revisions) (flutter/flutter#147688) 2024-05-02 [email protected] Allow explicit exclusion of packages from pinned packages in `flutter update-packages --force-update` (flutter/flutter#147679) 2024-05-02 [email protected] Implement getDryBaseline for Stack and Overlay (flutter/flutter#146253) 2024-05-02 [email protected] Roll Flutter Engine from 2d73fa207927 to f56c20c6ac67 (2 revisions) (flutter/flutter#147681) 2024-05-02 [email protected] Update selectable_text_test.dart (flutter/flutter#147677) 2024-05-01 [email protected] Roll Flutter Engine from c536a14052e5 to 2d73fa207927 (2 revisions) (flutter/flutter#147678) 2024-05-01 [email protected] Implement computeDryBaseline for `RenderWrap` (flutter/flutter#146260) 2024-05-01 [email protected] Roll Flutter Engine from 842cf254ec58 to c536a14052e5 (1 revision) (flutter/flutter#147675) 2024-05-01 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.3.0 to 4.3.1 (flutter/flutter#147674) 2024-05-01 [email protected] Remove obsolete performance analysis tools. (flutter/flutter#147663) 2024-05-01 [email protected] Roll Flutter Engine from 5129b4919434 to 842cf254ec58 (3 revisions) (flutter/flutter#147670) 2024-05-01 [email protected] fix DropdownMenu overflow (flutter/flutter#147233) 2024-05-01 [email protected] [web] remove platform_messages_integration test (flutter/flutter#147654) 2024-05-01 [email protected] Fix `TextField` horizontal drag conflicts (flutter/flutter#147341) 2024-05-01 [email protected] `flutter/lib/src/`: refactoring if-chains into switch expressions (flutter/flutter#147472) 2024-05-01 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Draggable feedback positioning (#145647)" (flutter/flutter#147658) 2024-05-01 [email protected] Roll Flutter Engine from 0014e0353aa9 to 5129b4919434 (1 revision) (flutter/flutter#147655) 2024-05-01 [email protected] add lang attribute to the a11y_assessments app (flutter/flutter#147586) 2024-05-01 [email protected] Draggable feedback positioning (flutter/flutter#145647) 2024-05-01 [email protected] Roll Flutter Engine from 0ce67714ce4c to 0014e0353aa9 (13 revisions) (flutter/flutter#147649) 2024-05-01 [email protected] Add test for animated_fractionally_sized_box.0.dart API example. (flutter/flutter#146721) 2024-05-01 [email protected] Roll Packages from cc47b06 to aea93d2 (5 revisions) (flutter/flutter#147647) 2024-05-01 [email protected] Update reorderable_list.dart to use Dart 3 return switch statement for consistency (flutter/flutter#147505) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 ...
Reopened after revert in #147658 Another test was added in the meantime to `draggable_test.dart` that didn't call `gesture.up()`. I added this call to the test and now all tests pass. --- # Original Description (#145647): We changed the coordinates used to position the `Draggable` feedback by transforming them into the `Overlay`s coordinate space. This has no influence on any untransformed `Overlay`, most Flutter apps should be not affected. This PR fixes the positioning of the feedback in transformed context (see #145639 for before video): https://github.com/flutter/flutter/assets/42270125/df34e198-0667-453d-a27a-a79b2e2825a1 - fixes #145639 ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [Data Driven Fixes]: https://github.com/flutter/flutter/wiki/Data-driven-Fixes --------- Co-authored-by: Jesper Bellenbaum <[email protected]>
Reopened after revert in flutter#147658 Another test was added in the meantime to `draggable_test.dart` that didn't call `gesture.up()`. I added this call to the test and now all tests pass. --- # Original Description (flutter#145647): We changed the coordinates used to position the `Draggable` feedback by transforming them into the `Overlay`s coordinate space. This has no influence on any untransformed `Overlay`, most Flutter apps should be not affected. This PR fixes the positioning of the feedback in transformed context (see flutter#145639 for before video): https://github.com/flutter/flutter/assets/42270125/df34e198-0667-453d-a27a-a79b2e2825a1 - fixes flutter#145639 ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [Data Driven Fixes]: https://github.com/flutter/flutter/wiki/Data-driven-Fixes --------- Co-authored-by: Jesper Bellenbaum <[email protected]>
We changed the coordinates used to position the
Draggablefeedback by transforming them into theOverlays coordinate space. This has no influence on any untransformedOverlay, most Flutter apps should be not affected.This PR fixes the positioning of the feedback in transformed context (see #145639 for before video):
Screenshot.2024-03-23.at.20.30.06.mp4
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.