@egjs/axes
Version:
A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.
51 lines (50 loc) • 1.81 kB
TypeScript
import { ActiveEvent, ElementType, InputEventType } from "../types";
import { InputType, InputTypeObserver } from "./InputType";
export interface PanInputOption {
inputType?: string[];
inputKey?: string[];
inputButton?: string[];
scale?: number[];
thresholdAngle?: number;
threshold?: number;
preventClickOnDrag?: boolean;
preventDefaultOnDrag?: boolean;
iOSEdgeSwipeThreshold?: number;
releaseOnScroll?: boolean;
touchAction?: string;
}
export declare const getDirectionByAngle: (angle: number, thresholdAngle: number) => number;
export declare class PanInput implements InputType {
options: PanInputOption;
axes: string[];
element: HTMLElement;
protected _observer: InputTypeObserver;
protected _direction: number;
protected _enabled: boolean;
protected _activeEvent: ActiveEvent;
private _originalCssProps;
private _atRightEdge;
private _rightEdgeTimer;
private _dragged;
private _isOverThreshold;
constructor(el: ElementType, options?: PanInputOption);
mapAxes(axes: string[]): void;
connect(observer: InputTypeObserver): InputType;
disconnect(): this;
destroy(): void;
enable(): this;
disable(): this;
isEnabled(): boolean;
release(): this;
protected _onPanstart(event: InputEventType): void;
protected _onPanmove(event: InputEventType): void;
protected _onPanend(event: InputEventType): void;
protected _attachWindowEvent(activeEvent: ActiveEvent): void;
protected _detachWindowEvent(activeEvent: ActiveEvent): void;
protected _getOffset(properties: number[], direction: boolean[]): number[];
private _getDistance;
private _attachElementEvent;
private _detachElementEvent;
private _preventClickWhenDragged;
private _voidFunction;
}