Skip to content
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

feat(web): gesture-selection 🐵 #9407

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

jahorton
Copy link
Contributor

@jahorton jahorton commented Aug 3, 2023

The new MatcherSelector class facilitates proper update synchronization among all GestureMatchers that share one or more common GestureSources and ensures that if more than one match completes successfully at the same time, the highest priority one wins and is selected as the "correct" gesture component model for this "stage" of the ongoing gesture.

@keymanapp-test-bot skip

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Aug 3, 2023
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Aug 3, 2023

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot changed the title feat(web): gesture-selection and start of gesture-staging feat(web): gesture-selection and start of gesture-staging 🐵 Aug 3, 2023
@keymanapp-test-bot keymanapp-test-bot bot added this to the A17S18 milestone Aug 3, 2023
@github-actions github-actions bot added web/ and removed web/ labels Aug 4, 2023
@jahorton jahorton changed the base branch from refactor/web/gesture-source-paradigm to chore/web/GestureSource-rename August 4, 2023 09:17
@mcdurdin mcdurdin modified the milestones: A17S18, A17S19 Aug 5, 2023
@github-actions github-actions bot added web/ and removed web/ labels Aug 8, 2023
Base automatically changed from chore/web/GestureSource-rename to feature-gestures August 11, 2023 05:15
@github-actions github-actions bot added web/ and removed web/ labels Aug 11, 2023
@jahorton jahorton changed the base branch from feature-gestures to refactor/web/multi-source-mocked-simulation August 11, 2023 07:50
@github-actions github-actions bot added web/ and removed web/ labels Aug 11, 2023
@github-actions github-actions bot added web/ and removed web/ labels Aug 11, 2023
@github-actions github-actions bot added web/ and removed web/ labels Aug 11, 2023
@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-missing User tests have not yet been defined for the PR label Aug 11, 2023
@jahorton jahorton marked this pull request as ready for review August 11, 2023 09:13
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I guess? It's pretty abstract at this point so hard to know really what it's all doing without the entire model of it in my mind. So I've just looked at the code, lots of comments which is good, nothing obviously messy.

I don't know how this will perform?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is needed for this module when none of our other mocha-based unit tests need it?

Copy link
Contributor Author

@jahorton jahorton Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until now, I've generally been running the mocha tests from the command-line and placing breakpoints when debugging is necessary. I've actually avoided setting up any launch.json configurations within VS Code until now. Breakpoints from main-project code seem to activate more consistently during TS-spec'd tests for me when I launch them through a launch.json configuration than when I run them via console. I'd been having trouble with that when validating recent code changes... since I started writing tests for these newer parts of the gesture engine in TS rather than plain JS.

This file exists to facilitate launch.json debugging configurations, ensuring that it refers to the "correct" tsconfig.json file when using ts-node. As gesture-recognizer needs to target ES5, but its tests don't, things go funky during TS-test loading should the ES5 config (the one in the project's root folder, thus most likely to be treated as "default") be picked.

@mcdurdin mcdurdin modified the milestones: A17S19, A17S20 Aug 18, 2023

// Ensure that any essentially-synchronous resolving GestureMatchers resolve in order of
// their specified `resolutionPriority`, with larger values first.
await this.promisePrioritizer.queueWithPriority(matcher.model.resolutionPriority);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. Revisited this after noting the main comment of #9453 (review):

I don't really understand the big picture gestures use case as the mechanical unit test of correctness doesn't really explain why the gestures design would need such a thing.

I did have a vacation since then, so I figured the refresher might help. Turns out... the unit tests actually pass now with this disabled!

I think I see what happened now:

/*
* Easiest way to ensure resolution priorities are respected: keep 'em sorted in descending order.
* When we iterate through on update-steps, we go sequentially; the first Promise to be marked
* 'resolved' wins.
*/
this.potentialMatchers.sort((a, b) => b.model.resolutionPriority - a.model.resolutionPriority);
// Now that all GestureMatchers are built, reset ALL of our sync-update-check hooks.
this.resetSourceHooks();

I'd been having some serious issues getting certain multitap scenarios to work correctly, largely due to the timing by which source-subview updates were being processed and how that related to the processsing of path-termination.

Lines 145-146 above were part of the last additions to this PR - additions that fixed some "fun" underlying problems with update timings. Ensuring that updates were processed in the correct order probably fixed the same issues that were previously undermining resolutionPriority ordering - for some gesture types, path updates can trigger resolution of their corresponding gesture matcher, after all.

So... we might actually able able to straight-up drop the Promise prioritizer thing after all. At least it did help lead me to the true underlying cause for the issues I'd been using it to address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And now... fully dropped.

@github-actions github-actions bot added web/ and removed web/ labels Sep 26, 2023
Base automatically changed from refactor/web/multi-source-mocked-simulation to feature-gestures September 27, 2023 01:55
@jahorton jahorton merged commit 67bcc9c into feature-gestures Sep 27, 2023
2 checks passed
@jahorton jahorton deleted the feat/web/gesture-selection branch September 27, 2023 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants