@uploadcare/file-uploader
Version:
Building blocks for Uploadcare products integration
106 lines • 2.93 kB
TypeScript
export class EditorImageCropper extends Block {
init$: {
image: null;
'*padding': number;
/** @type {Operations} */
'*operations': Operations;
/** @type {import('./types.js').Rectangle} */
'*imageBox': import("./types.js").Rectangle;
/** @type {import('./types.js').Rectangle} */
'*cropBox': import("./types.js").Rectangle;
};
/** @private */
private _commitDebounced;
/** @private */
private _handleResizeThrottled;
_imageSize: {
width: number;
height: number;
};
/** @private */
private _handleResize;
/** @private */
private _syncTransformations;
/** @private */
private _initCanvas;
_canvas: HTMLCanvasElement | undefined;
_ctx: CanvasRenderingContext2D | null | undefined;
/** @private */
private _alignImage;
/** @private */
private _alignCrop;
/** @private */
private _drawImage;
/** @private */
private _draw;
/**
* @private
* @param {{ fromViewer?: boolean }} options
*/
private _animateIn;
/**
* @private
* @returns {NonNullable<import('./types.js').Transformations['crop']>['dimensions']}
*/
private _getCropDimensions;
/**
* @private
* @returns {import('./types.js').Transformations['crop']}
*/
private _getCropTransformation;
/** @private */
private _commit;
/**
* @param {String} operation
* @param {Number} value
* @returns {void}
*/
setValue(operation: string, value: number): void;
/**
* @param {keyof Operations} operation
* @returns {Number | boolean}
*/
getValue(operation: keyof Operations): number | boolean;
/**
* @param {import('./types.js').ImageSize} imageSize
* @param {{ fromViewer?: boolean }} options
*/
activate(imageSize: import("./types.js").ImageSize, { fromViewer }?: {
fromViewer?: boolean;
}): Promise<void>;
_isActive: boolean | undefined;
_observer: ResizeObserver | undefined;
deactivate({ reset }?: {
reset?: boolean | undefined;
}): void;
/** @private */
private _transitionToCrop;
/** @private */
private _transitionToImage;
/** @private */
private _reset;
/**
* @private
* @param {String} originalUrl
* @param {import('./types.js').Transformations} transformations
* @returns {Promise<HTMLImageElement>}
*/
private _waitForImage;
_cancelPreload: (() => void) | undefined;
/**
* @private
* @param {String} src
* @returns {() => void} Destructor
*/
private _handleImageLoading;
}
export namespace EditorImageCropper {
let template: string;
}
export type Operations = {
flip: boolean;
mirror: boolean;
rotate: number;
};
import { Block } from '../../../abstract/Block.js';
//# sourceMappingURL=EditorImageCropper.d.ts.map