UNPKG

@learn-hunger/visual-gestures

Version:

VisualGestures.js is a package that empowers users to effortlessly control the cursor, including actions such as hover, click, drag, and drop, through precise finger movements in the air.

57 lines (56 loc) 2.14 kB
import { AVgCommon } from "./app/shared/vg-cursor-pointer-abstract"; import { VgPointer } from "./app/pointer/custom-events"; import { EHandLandmarks } from "./app/utilities/vg-constants"; import { IGestureCustomProps } from "./app/utilities/vg-types"; import { INormalizedLandmark } from "./app/utilities/vg-types-handlandmarks"; /** * Central Class to Hold all kinds of gestures such as hand for now and * may be audio gestures for future */ export declare class VisualGestures extends AVgCommon { /** * props are the properties being sent to the * event handlers and its corresponding custom event classes * It contains common properties */ props: IGestureCustomProps; /** * It is the composition of VgPointer class * It is the central handler for all hand gesture events * Core logic for hand gestures is maintainted in this class */ mouseEvents: VgPointer; constructor(container?: HTMLElement, pointer?: EHandLandmarks); /** * here common properties gets updated whenever landmarks gets detected * on each frame * @private * @type {{}} */ private set setLandmarks(value); /** * Calculates and normalizes the position of the cursor position * to fit within the viewport of the container element * called only when landmarks got detected * @private * @readonly * @type {MouseEventInit} */ private get mouseInit(); /** * It assigns the timestamp of the current frame and previous frame * which will be used in core logic of the gestures in vgPointer class * @private * @type {number} */ private set setTimer(value); /** * This is the handler which gets called by the end developer * based on the handlandmarks detected setLandmarks and mouseInit gets called * Timer gets called every time to update the timestamp irrespective of handlandmarks detected or not * @param landmark * @param timeStamp * @param cursorSpeed */ detect(landmark: INormalizedLandmark[] | undefined, timeStamp: number, cursorSpeed?: number): void; }