mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 19:35:32 +00:00
fix(web): clear of pending subsegment should refresh segment stats
This commit is contained in:
parent
2e970140ee
commit
c2dcffc043
2 changed files with 19 additions and 1 deletions
|
|
@ -232,6 +232,9 @@ namespace com.keyman.osk {
|
|||
// the need to rely on Segment events for that; even that's better off handled with path.coords
|
||||
// events instead.
|
||||
this.pendingSubsegmentation = null;
|
||||
|
||||
// If there was a pending subsegment, we need to remove its components from the published segment stats.
|
||||
this.pathSegment.updateStats(this.committedInterval);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ namespace com.keyman.osk {
|
|||
private _resolutionPromise: Promise<void>;
|
||||
private _resolutionPromiseResolver: () => void;
|
||||
|
||||
private _isResolved: boolean = false;
|
||||
|
||||
/**
|
||||
* Intended for internal-use only; this is utilized during the segmentation process.
|
||||
*/
|
||||
|
|
@ -69,7 +71,10 @@ namespace com.keyman.osk {
|
|||
});
|
||||
|
||||
this._resolutionPromise = new Promise<void>((resolve) => {
|
||||
this._resolutionPromiseResolver = resolve;
|
||||
this._resolutionPromiseResolver = () => {
|
||||
this._isResolved = true;
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -85,10 +90,16 @@ namespace com.keyman.osk {
|
|||
}
|
||||
|
||||
protected setPeakSpeed(speed: number) {
|
||||
if(this._isResolved) {
|
||||
throw new Error("May not modify a resolved segment!");
|
||||
}
|
||||
this._peakSpeed = speed;
|
||||
}
|
||||
|
||||
protected updateStats(totalStats: CumulativePathStats) {
|
||||
if(this._isResolved) {
|
||||
throw new Error("May not modify a resolved segment!");
|
||||
}
|
||||
this._stats = totalStats;
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +108,10 @@ namespace com.keyman.osk {
|
|||
throw new Error("Cannot recognize the segment - lacking critical metadata");
|
||||
}
|
||||
|
||||
if(this._isResolved) {
|
||||
throw new Error("May not modify a resolved segment!");
|
||||
}
|
||||
|
||||
if(this._type === undefined) {
|
||||
this._type = type;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue