@glodon-aiot/react-components
Version:
aiot react components
50 lines (49 loc) • 1.34 kB
TypeScript
import { Point } from '.';
export interface DrawableContext {
markerPoint?: Point;
polygonPoints?: Point[];
lineStart?: Point;
lineEnd?: Point;
movingPoint?: Point;
}
export type DrawableEvent = {
type: 'START_ADD_MARKER';
} | {
type: 'START_DRAW_LINE';
} | {
type: 'START_DRAW_POLYGON';
} | {
type: 'ADD_MARKER';
point: Point;
} | {
type: 'ADD_LINE_START';
point: Point;
} | {
type: 'ADD_LINE_END';
point: Point;
} | {
type: 'DRAW_LINE_COMPLETED';
} | {
type: 'DRAW_POLYGON';
start: Point;
} | {
type: 'ADD_POLYGON_POINT';
point: Point;
} | {
type: 'DRAW_POLYGON_COMPLETE';
} | {
type: 'MOUSE_MOVE';
point: Point;
} | {
type: 'RESET';
} | {
type: 'CANCEL';
};
type SimpleState<T> = {
value: T;
context: DrawableContext;
};
type S<T> = SimpleState<T>;
export type DrawableState = S<'idle'> | S<'addingMarker'> | S<'drawingLine'> | S<'drawingPolygon'> | S<'drawCompleted'> | S<'canceled'>;
export declare const drawableMachine: import('xstate').StateMachine<DrawableContext, any, DrawableEvent, DrawableState, import('xstate').BaseActionObject, import('xstate').ServiceMap, import('xstate').ResolveTypegenMeta<import('xstate').TypegenDisabled, DrawableEvent, import('xstate').BaseActionObject, import('xstate').ServiceMap>>;
export {};