mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-10 02:45:32 +00:00
fix(web): segment.angle spec, move-based segment recognition
This commit is contained in:
parent
559a909ea8
commit
7b2da89e8d
2 changed files with 8 additions and 3 deletions
|
|
@ -197,9 +197,10 @@ namespace com.keyman.osk {
|
|||
// it's time to commit to classifying the in-construction Segment.
|
||||
const alreadyElapsed = fullStatsWithIncoming.duration;
|
||||
const recognitionWaitTime = this.classifier.config.holdMinimumDuration - alreadyElapsed;
|
||||
const recognitionFromMove = (this.pathSegment.distance > this.classifier.config.holdMoveTolerance);
|
||||
|
||||
// `undefined` if and only if still unrecognized.
|
||||
if(recognitionWaitTime <= 0 && !this._pathSegment.isRecognized) {
|
||||
if((recognitionFromMove || recognitionWaitTime <= 0) && !this._pathSegment.isRecognized) {
|
||||
const classification = this.classifier.classifySegment(fullStatsWithIncoming);
|
||||
|
||||
// Based on the specification for segment classification, there WILL be a classification
|
||||
|
|
|
|||
|
|
@ -584,10 +584,10 @@ namespace com.keyman.osk {
|
|||
*/
|
||||
public get angle() {
|
||||
if(this.sampleCount == 1 || !this.lastSample || !this.initialSample) {
|
||||
return Number.NaN;
|
||||
return undefined;
|
||||
} else if(this.netDistance < 1) {
|
||||
// < 1 px, thus sub-pixel, means we have nothing relevant enough to base an angle on.
|
||||
return Number.NaN;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const xDelta = this.lastSample.targetX - this.initialSample.targetX;
|
||||
|
|
@ -618,6 +618,10 @@ namespace com.keyman.osk {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if(isNaN(this.angle) || this.angle === null || this.angle === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const buckets = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'n'];
|
||||
|
||||
// We could be 'more efficient' and use radians here instead, but this
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue