@saran-ign/video-annotation-tool
Version:
[](https://www.npmjs.com/package/@saran-ign/video-annotation-tool) [](https://www.npmjs.co
45 lines (44 loc) • 1.53 kB
TypeScript
import React, { ReactNode } from "react";
interface Shape {
id: string;
[key: string]: any;
}
interface Dimensions {
width: number;
height: number;
}
interface Position {
x: number | null;
y: number | null;
}
interface CanvasContextType {
shapes: Shape[];
setShapes: React.Dispatch<React.SetStateAction<Shape[]>>;
isDrawing: boolean;
setIsDrawing: React.Dispatch<React.SetStateAction<boolean>>;
newShape: Shape | null;
setNewShape: React.Dispatch<React.SetStateAction<Shape | null>>;
selectedShapeId: string | null;
setSelectedShapeId: React.Dispatch<React.SetStateAction<string | null>>;
rectPosititon: Position;
setRectPosition: React.Dispatch<React.SetStateAction<Position>>;
videoRefVal: React.RefObject<HTMLVideoElement> | null;
setVideoRefVal: React.Dispatch<React.SetStateAction<React.RefObject<HTMLVideoElement> | null>>;
dimensions: Dimensions;
setDimensions: React.Dispatch<React.SetStateAction<Dimensions>>;
history: Shape[][];
setHistory: React.Dispatch<React.SetStateAction<Shape[][]>>;
redoStack: Shape[][];
setRedoStack: React.Dispatch<React.SetStateAction<Shape[][]>>;
undo: () => void;
redo: () => void;
deleteShape: () => void;
}
interface CanvasProviderProps {
children: ReactNode;
shapes: Shape[];
setShapes: React.Dispatch<React.SetStateAction<Shape[]>>;
}
export declare const CanvasProvider: React.FC<CanvasProviderProps>;
export declare const useCanvas: () => CanvasContextType;
export {};