react-image-label
Version:
A comprehensive package for tagging images.
48 lines (43 loc) • 1.51 kB
TypeScript
import React, { FC } from 'react';
import { Shape, Shortcut } from 'image-labeling';
export { Circle, Dot, Ellipse, Point, Polygon, Rectangle, Shape } from 'image-labeling';
declare const useImageAnnotator: () => {
setHandles: React.Dispatch<React.SetStateAction<AnnotatorHandles | undefined>>;
annotator: AnnotatorHandles | undefined;
};
type AnnotatorHandles = {
drawRectangle(): void;
drawPolygon(): void;
drawCircle(): void;
drawEllipse(): void;
drawDot(): void;
stop: () => void;
stopEdit: () => void;
edit: (id: number) => void;
delete: (id: number) => void;
updateCategories: (id: number, categories: string[], color?: string) => void;
zoom: (factor: number, relative?: boolean) => void;
getShapes: () => Shape[];
container: HTMLDivElement;
};
declare const ImageAnnotator: FC<ImageAnnotatorProps>;
interface ImageAnnotatorProps {
onReady?: (annotator: AnnotatorHandles) => any;
onAdded?: (shape: Shape) => any;
onEdited?: (shape: Shape) => any;
onSelected?: (shape: Shape) => any;
onContextMenu?: (shape: Shape) => any;
imageUrl?: string;
shapes?: Shape[] | any[];
naturalSize?: boolean;
width?: number | string;
height?: number | string;
discRadius?: number;
hideBorder?: boolean;
shortcut?: Shortcut;
categoryOpt?: {
vertical: 'top' | 'middle' | 'bottom';
} | undefined;
setHandles: (handles: AnnotatorHandles) => void;
}
export { ImageAnnotator, useImageAnnotator };