@mescius/dsimageviewer
Version:
Document Solutions Image Viewer
56 lines (55 loc) • 1.74 kB
TypeScript
export declare class DropFileAreaHelper {
private _dropArea;
private _viewer;
private _onFileDrop;
private _onImageUrlDrop;
private _handlers;
private _activated;
constructor(_dropArea: HTMLElement, _viewer: any, //GcImageViewer,
_onFileDrop: (file: any, point: any) => void, _onImageUrlDrop: (imgUrl: any, point: any) => void);
on(): void;
off(): void;
private _registerEvents;
private _unregisterEvents;
/**
* A listener for the dragenter and dragover events are used to indicate valid drop targets
* a dragged item enters a valid drop target
**/
private _dragEnter;
/**
* A listener for the dragenter and dragover events are used to indicate valid drop targets.
* a dragged item is being dragged over a valid drop target, every few hundred milliseconds.
**/
private _dragOver;
/**
* a dragged item leaves a valid drop target.
**/
private _dragLeave;
/**
* an item is dropped on a valid drop target
**/
private _drop;
private _handleFiles;
/**
* Returns canvas size if any.
* @param canvas
*/
static getCanvasSize(canvas?: HTMLCanvasElement): {
h: number;
w: number;
};
/**
* Load Image from Url.
* @param url
*/
static loadImageFromUrl(url: string): Promise<HTMLImageElement | null>;
/**
* Gets image data from HTMLImageElement.
* @param img
*/
static imageToBytes(img: HTMLImageElement): Promise<Uint8Array | null>;
/**
* Returns result image blob data if any.
**/
static canvasToImageData(canvas?: HTMLCanvasElement): Promise<Uint8Array | null>;
}