eyedropper-polyfill
Version:
EyeDropper API Polyfill
70 lines (69 loc) • 1.54 kB
TypeScript
import { EyeDropper, ColorSelectionOptions, ColorSelectionResult } from './types';
/**
* EyeDropper API polyfill
* https://wicg.github.io/eyedropper-api/#dom-colorselectionoptions
*/
export declare class EyeDropperPolyfill implements EyeDropper {
private colorSelectionResult?;
private previousDocumentCursor?;
private canvas?;
private canvasCtx?;
private resolve?;
private lastPoint?;
private magnification;
constructor();
/**
* Opens the polyfilled eyedropper
*
* §3.3 EyeDropper interface ► `open()`
*/
open(options?: ColorSelectionOptions): Promise<ColorSelectionResult>;
/**
* Starting eyedropper mode
*/
private start;
/**
* Stopping eyedropper mode
*/
private stop;
/**
* Creates fake screenshot of page and assign it to the body
*/
private createScreenshot;
/**
* Removes screenshot from page
*/
private removeScreenshot;
/**
* Sets waiting cursor
*/
private setWaitingCursor;
/**
* Removes waiting cursor
*/
private revertWaitingCursor;
/**
* Binds events
*/
private bindEvents;
/**
* Unbinds `mousemove` events
*/
private unbindEvents;
/**
* `click` handler
*/
private onClick;
/**
* `mousemove` handler
*/
private onMouseMove;
/**
* Detects color from canvas data
*/
private detectColor;
/**
* Canvas styles creator
*/
private addCanvasStyle;
}