mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 11:25:34 +00:00
43 lines
No EOL
1 KiB
TypeScript
43 lines
No EOL
1 KiB
TypeScript
namespace com.keyman.osk {
|
|
/**
|
|
* We want these to be readily and safely converted to and from
|
|
* JSON (for unit test use and development)
|
|
*/
|
|
export interface InputSample {
|
|
/**
|
|
* Represents the x-coordinate of the input sample
|
|
* in 'client' / viewport coordinates.
|
|
*/
|
|
clientX?: number;
|
|
|
|
/**
|
|
* Represents the x-coordinate of the input sample in
|
|
* coordinates relative to the recognizer's `targetRoot`.
|
|
*/
|
|
targetX: number;
|
|
|
|
/**
|
|
* Represents the y-coordinate of the input sample
|
|
* in 'client' / viewport coordinates.
|
|
*/
|
|
clientY?: number;
|
|
|
|
/**
|
|
* Represents the y-coordinate of the input sample in
|
|
* coordinates relative to the recognizer's `targetRoot`.
|
|
*/
|
|
targetY: number;
|
|
|
|
/**
|
|
* Represents the timestamp at which the input was observed
|
|
* (in ms)
|
|
*/
|
|
t: number;
|
|
}
|
|
|
|
export type InputSampleSequence = InputSample[];
|
|
|
|
export function isAnInputSample(obj: any): obj is InputSample {
|
|
return 'targetX' in obj && 'targetY' in obj && 't' in obj;
|
|
}
|
|
} |