@ahmafi/pixi-viewport
Version:
A highly configurable viewport/2D camera designed to work with pixi.js. Features include dragging, pinch-to-zoom, mouse wheel zooming, decelerated dragging, follow target, snap to point, snap to zoom, clamping, bouncing on edges, and move on mouse edges.
32 lines (31 loc) • 1.01 kB
TypeScript
import { Plugin } from './Plugin';
import { IPointData, Point } from '@pixi/core';
import type { Viewport } from '../Viewport';
export interface IWheelOptions {
percent?: number;
smooth?: false | number;
interrupt?: boolean;
reverse?: boolean;
center?: Point | null;
lineHeight?: number;
axis?: 'all' | 'x' | 'y';
keyToPress?: string[] | null;
trackpadPinch?: boolean;
wheelZoom?: boolean;
}
export declare class Wheel extends Plugin {
readonly options: Required<IWheelOptions>;
protected smoothing?: IPointData | null;
protected smoothingCenter?: Point | null;
protected smoothingCount?: number;
protected keyIsPressed: boolean;
constructor(parent: Viewport, options?: IWheelOptions);
protected handleKeyPresses(codes: string[]): void;
protected checkKeyPress(): boolean;
down(): boolean;
protected isAxisX(): boolean;
protected isAxisY(): boolean;
update(): void;
private pinch;
wheel(e: WheelEvent): boolean;
}