Skip to content

feat(web): start of input boundary generalization 🐵#6844

Merged
jahorton merged 19 commits intofeat/web/gesture-recognizer-mainfrom
feat/web/gesture-recognizer-bounds
Jul 15, 2022
Merged

feat(web): start of input boundary generalization 🐵#6844
jahorton merged 19 commits intofeat/web/gesture-recognizer-mainfrom
feat/web/gesture-recognizer-bounds

Conversation

@jahorton
Copy link
Copy Markdown
Contributor

@jahorton jahorton commented Jun 24, 2022

The VisualKeyboard class has some... fun logic for determining when to cancel an ongoing touch or mouse interaction. Input may continue slightly out of bounds - but not too far. Input that gets too close to a screen edge is also interpreted as cancellation (since you can't detect past physical device boundaries) - unless the interaction started very near to those boundaries.

After some thought, analysis, and effort... I've come up with a scheme that will allow this to be specified relatively cleanly - both within this module and within KeymanWeb once integrated. This scheme will also allow for other boundary specifications - like those that will be needed for a gesture testing host/demo page.

@keymanapp-test-bot skip

@jahorton jahorton added this to the A16S5 milestone Jun 24, 2022
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Jun 24, 2022
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Jun 24, 2022

@jahorton jahorton force-pushed the feat/web/gesture-recognizer-base branch from 1d3ff60 to 6b42436 Compare June 27, 2022 04:47
@jahorton jahorton force-pushed the feat/web/gesture-recognizer-bounds branch from dd6fa6e to 6e45ca9 Compare June 27, 2022 04:47
@mcdurdin mcdurdin modified the milestones: A16S5, A16S6 Jul 9, 2022
@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-missing User tests have not yet been defined for the PR label Jul 11, 2022
@jahorton jahorton marked this pull request as ready for review July 11, 2022 08:35
Copy link
Copy Markdown
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.

There seems to be some code repetition which should be addressed. A number of other nits.

readonly safeBoundPadding?: number | number[];
}

export interface FinalizedGestureRecognizerConfiguration extends Nonoptional<GestureRecognizerConfiguration> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a real need for a separate interface? It seems like it adds a lot of boilerplate.

Copy link
Copy Markdown
Contributor Author

@jahorton jahorton Jul 13, 2022

Choose a reason for hiding this comment

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

The intent is to keep things relatively DRY while allowing different type specifications for the "public" version of the config and the pre-processed internal version. These fields will be used on every input event, so I feel a little optimization here is merited - especially for avoiding the need to constantly reinitialize paddedSafeBounds. Unless we wanted to expose that and make it optional on the input object?

It's also nice to eliminate the type-ambiguity of safeBoundPadding once configuration is done; that's less type-checking boilerplate elsewhere in the code. (Particularly, in the new zoneBoundaryChecker.ts.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's just a little too OO for my comfort -- why not just make paddedSafeBounds optional on the input object as you say with corresponding comments? It's all internal anyway so it's not like we are making API contracts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've made an adjustment in this regard; are the recent changes enough to address this concern?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes thanks

Comment on lines +83 to +85
if(!ZoneBoundaryChecker.inputStartOutOfBoundsCheck(coord, this.config)) {
this.disabledSafeBounds = ZoneBoundaryChecker.inputStartSafeBoundProximityCheck(coord, this.config);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is this doing? It's not obvious why you are doing this -- please add a code comment!

Copy link
Copy Markdown
Contributor Author

@jahorton jahorton Jul 13, 2022

Choose a reason for hiding this comment

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

This comment is a secondary target of this comment: #6843 (comment)

This addresses probably the most niche aspect of the OSK's touchpoint management logic, so I'm not exactly surprised by the request. Re #6842's visual: "If the touchpoint is within the larger set of dashed lines but not the smaller set, remember which border(s) we started near." And that has a second half. Not exactly the simplest thing to document using only words; this is part of why I spent as much time as I did on the host page's visual design.

Base automatically changed from feat/web/gesture-recognizer-base to feat/web/gesture-recognizer-main July 14, 2022 08:30
@jahorton jahorton merged commit 889b56f into feat/web/gesture-recognizer-main Jul 15, 2022
@jahorton jahorton deleted the feat/web/gesture-recognizer-bounds branch July 15, 2022 05:35
@jahorton jahorton mentioned this pull request Sep 19, 2022
1 task
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