@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
104 lines (103 loc) • 2.94 kB
TypeScript
import { PointF } from "@aurigma/design-atoms-model/Math";
import { Item } from "@aurigma/design-atoms-model/Product/Items";
export interface IInputManager {
addOnInput(handler: (params: IInputParams) => any): any;
removeOnInput(handler: (params: IInputParams) => any): any;
raiseNativeEvent(event: INativeEvent): any;
}
export interface INativeEvent {
preventDefault?: () => any;
eventType: NativeEventType;
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
}
export interface INativeKeyEvent extends INativeEvent {
code: string;
key: string;
eventType: NativeEventType.KeyDown | NativeEventType.KeyUp;
}
export interface INativeMouseEvent extends INativeEvent {
coordinates: PointF;
button?: Button;
eventType: NativeEventType.MouseDown | NativeEventType.MouseUp | NativeEventType.MouseMove;
}
export interface INativeTouchEvent extends INativeEvent {
touches: PointF[];
changedTouches: PointF[];
eventType: NativeEventType.TouchEnd | NativeEventType.TouchMove | NativeEventType.TouchStart;
}
export declare function isNativeMouseEvent(e: INativeMouseEvent | INativeTouchEvent): e is INativeMouseEvent;
export interface INativeWheelEvent extends INativeEvent {
delta: PointF;
}
export declare enum NativeEventType {
MouseDown = 0,
MouseUp = 1,
MouseMove = 2,
TouchStart = 3,
TouchEnd = 4,
TouchMove = 5,
KeyDown = 6,
KeyUp = 7,
Wheel = 8
}
export interface IInputParams {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
type: InputType;
preventDefault: () => any;
}
export interface IPointerParams extends IInputParams {
workspace: PointF;
page: PointF;
button: Button;
isMobile: boolean;
clickCount: number;
}
export interface IMovePointerParams extends IPointerParams {
startWorkspace: PointF;
startPage: PointF;
state: InputState;
}
export interface IWheelParams extends IInputParams {
delta: PointF;
}
export interface ITransformViewportParams extends IInputParams {
scale: number;
translate: PointF;
state: InputState;
}
export interface IKeyboardEventParams extends IInputParams {
code: string;
key: string;
state: InputState;
}
export interface IContextMenuParams {
pointerParams: IPointerParams;
items: Item[];
}
export declare enum InputType {
Click = "Click",
Transform = "Transform",
PointerDown = "PointerDown",
Move = "Move",
LongTap = "LongTap",
Key = "Key",
Wheel = "Wheel",
Hover = "Hover"
}
export declare enum Button {
None = "None",
Primary = "Primary",
Secondary = "Secondary",
Tertiary = "Tertiary"
}
export declare enum InputState {
Started = "Started",
InProgress = "InProgress",
Finished = "Finished"
}