@betterthings/scissors
Version:
handy image cropper with focus point editor
51 lines (50 loc) • 1.28 kB
TypeScript
import * as Immutable from 'immutable';
import * as ReactCrop from 'react-image-crop';
export interface Value {
imageUrl: string;
image: ImageInfo | null;
crop: CropInfo | null;
focus: Point | null;
aspect: number;
}
export interface Size {
width: number;
height: number;
}
export declare type ImageInfo = Size;
export interface CropInfo {
x: number;
y: number;
width: number;
height: number;
}
export interface Point {
x: number;
y: number;
}
declare const ScissorsState_base: Immutable.Record.Class;
export declare class ScissorsState extends ScissorsState_base {
imageUrl: string;
image: ImageInfo | null;
crop: CropInfo | null;
focus: Point | null;
aspect: number;
constructor(props?: Partial<Value>);
isValid(): boolean;
setImage(image: ImageInfo): this;
updateRelativeCrop(crop: ReactCrop.Crop): this;
getRelativeCrop(): ReactCrop.Crop | null;
getScale(reference: {
width: number;
height: number;
}): Point | null;
getCropCenter(): Point | null;
setFocus(focus: Point | null): this;
getRelativeFocus(): {
x: number;
y: number;
} | null;
setImageUrl(imageUrl: string): this;
setAspect(aspect: number): this;
}
export {};