UNPKG

@saran-ign/video-annotation-tool

Version:

[![npm version](https://img.shields.io/npm/v/@saran-ign/video-annotation-tool.svg)](https://www.npmjs.com/package/@saran-ign/video-annotation-tool) [![npm downloads](https://img.shields.io/npm/dm/@saran-ign/video-annotation-tool.svg)](https://www.npmjs.co

87 lines (86 loc) 2.49 kB
import React from "react"; interface ShapeProperties { type: "rectangle" | "circle" | "line"; x: number; y: number; width?: number; height?: number; radius?: number; points?: number[]; startTime: number; endTime: number; scaleX: number; scaleY: number; screenHeight: number; screenWidth: number; strokeWidth: number; opacity: number; } interface Shape { id: string; color: string; label: string; data: Record<string, any>; properties: ShapeProperties; } interface CanvasRef { undo: () => void; redo: () => void; deleteShape: () => void; } interface CanvasProps { children?: React.ReactNode; url: string; selectedShapeTool?: "rectangle" | "circle" | "line" | null; hideAnnotations?: boolean; lockEdit?: boolean; annotationColor?: string; opacity?: number; strokeWidth?: number; selectedAnnotationData?: (data: Shape | null) => void; videoControls?: boolean | Record<string, any>; videoTimeAnnotation: boolean; showVideoDuration: boolean; } export 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: { x: number; y: number; }; setRectPosition: React.Dispatch<React.SetStateAction<{ x: number; y: number; }>>; videoRefVal: React.RefObject<HTMLVideoElement> | null; setVideoRefVal: React.Dispatch<React.SetStateAction<React.RefObject<HTMLVideoElement> | null>>; dimensions: { width: number; height: number; }; setDimensions: React.Dispatch<React.SetStateAction<{ width: number; height: number; }>>; history: Shape[][]; setHistory: React.Dispatch<React.SetStateAction<Shape[][]>>; redoStack: Shape[][]; setRedoStack: React.Dispatch<React.SetStateAction<Shape[][]>>; undo: () => void; redo: () => void; deleteShape: () => void; } interface CanvasRef { undo: () => void; redo: () => void; deleteShape: () => void; } declare const Canvas: React.ForwardRefExoticComponent<CanvasProps & React.RefAttributes<CanvasRef>>; export default Canvas;