Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

improve modelity of multi finger move - #36948

Closed
winctoryang wants to merge 1 commit into
flutter-team-archive:mainfrom
winctoryang:main
Closed

winctoryang wants to merge 1 commit into
flutter-team-archive:mainfrom
winctoryang:main

Conversation

@winctoryang

Copy link
Copy Markdown

@dkwingsmt @goderbauer

Sorry for the late comments.

This is about the issues : Improve fidelity of multi-pointer drag gestures and this.

In iOS, we can use event.allTouches to replace touches in the function:
image
in FlutterViewControll.mm Line 1122.

If we do this, we can easly process the multi fingers' move not using endOfBatch (proposed in this). But the code of the flutter/engine need to modify firstly.

Why we need to modify FML_DCHECK to if statement?
When we use event.allTouches, the events' phase may be different. For example, the p1 down and p2 down firstly, if p1 move now, sometimes the event.allTouches phases are "p1 move and p2 move" and sometimes they are "p1 move and p2 down"(two fingers down together and move fast together, maybe but not must appear, you need try some times). That means p2 down event will triger twice! ( I do not know why, maybe a bug in ios? ). Please refer to the stack trace below.

wecom-temp-ab7c893082b4b7fbd3d64afc05237fd3

Pay attention to the phase. 0 means down and 1 means move. And it happend to touchesEnd too. So I modify the FML_DCHECK in PointerData::Change::kRemove, PointerData::Change::kDown and PointerData::Change::kUp.

After this merged, I will open the Improve fidelity of multi-pointer drag gestures again.
What are your opions?

@flutter-dashboard

Copy link
Copy Markdown

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 Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on 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.

@dkwingsmt

Copy link
Copy Markdown
Contributor

Yep, I'm working on this today.

Thanks for the write up and sorry for the delay.

@chinmaygarde

Copy link
Copy Markdown
Contributor

Are we still working on this? This is a pretty fundamental change to touch processing and is iOS only to boot. We'd need to migrate all platforms including changing the semantics in the embedder API. I don't think we should attempt such a breaking change.

@dkwingsmt

dkwingsmt commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor

I'd like to work on this but I'm a little busy recently. We've made a lengthy discussion but it seems there's no alternative for this batching information (unless we make even bigger changes). Without it we will not be able to properly calculate the scrolling distance.

The problem is that, the scrolling distance on iOS when multiple touches are involved is

max_distance(touches that moves upward) - max_distance(touches that moves downward)

Calculating it requires getting "all touch events within a batch". However, currently the touch events are sent separately, and only the changing touches are sent. This means that there's no way to know when a new batch starts.

Also I don't think it changes much in the embedder API. It will include all touches (instead of the changing touches) in the pointer packet, which isn't breaking, but makes stricter guarantees.

@chinmaygarde

Copy link
Copy Markdown
Contributor

Should we mark this as WIP till you have the bandwidth to pick this back up?

@chinmaygarde chinmaygarde added the Work in progress (WIP) Not ready (yet) for review! label Dec 1, 2022
@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@chinmaygarde

Copy link
Copy Markdown
Contributor

Closing this as stale. Please reopen once progress can be made.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

3 participants