@grapecity/gcpdfviewer
Version:
GcDocs PDF Viewer
77 lines (76 loc) • 2.18 kB
TypeScript
import { BasicPoint } from './types';
declare global {
interface CSSStyleDeclaration {
msTouchAction: string | null;
}
}
export interface Options {
dotSize?: number;
minDistance?: number;
backgroundColor?: string;
penColor?: string;
throttle?: number;
velocityFilterWeight?: number;
onBegin?: (event: MouseEvent | Touch) => void;
onEnd?: (event: MouseEvent | Touch) => void;
}
export interface PointGroup {
color: string;
width: number;
points: BasicPoint[];
}
export default class SignaturePad {
private canvas;
options: Options;
dotSize: number;
minDistance: number;
backgroundColor: string;
penColor: string;
throttle: number;
velocityFilterWeight: number;
onBegin?: (event: MouseEvent | Touch) => void;
onEnd?: (event: MouseEvent | Touch) => void;
private _ctx;
private _mouseButtonDown;
private _isEmpty;
private _lastPoints;
private _data;
private _lastVelocity;
private _lastWidth;
private _strokeMoveUpdate;
constructor(canvas: HTMLCanvasElement, options?: Options);
clear(): void;
fromDataURL(dataUrl: string, options?: {
ratio?: number;
width?: number;
height?: number;
}, callback?: (error?: string | Event) => void): void;
toDataURL(type?: string, encoderOptions?: number): string;
on(): void;
off(): void;
isEmpty(): boolean;
fromData(pointGroups: PointGroup[]): void;
toData(): PointGroup[];
private _handleMouseDown;
private _handleMouseMove;
private _handleMouseUp;
private _handleTouchStart;
private _handleTouchMove;
private _handleTouchEnd;
private _strokeBegin;
private _strokeUpdate;
private _strokeEnd;
private _handlePointerEvents;
private _handleMouseEvents;
private _handleTouchEvents;
private _reset;
private _createPoint;
private _addPoint;
private _calculateCurveWidths;
private _strokeWidth;
private _drawCurveSegment;
private _drawCurve;
private _drawDot;
private _fromData;
private _toSVG;
}