path change

This commit is contained in:
2026-05-08 17:16:38 +05:30
parent 7d3c36050b
commit f744747167

View File

@@ -15,6 +15,8 @@ import { DeleteConfirmModal } from "../components/annotate/DeleteConfirmModal";
import { drawOverlay, colorForClass } from "../components/extract/overlay";
import type { Settings } from "../types";
const DEFAULT_CLASS_ID = 0;
interface Props {
username: string;
settings: Settings | null;
@@ -63,7 +65,7 @@ function uuid(): string {
try {
const c = (globalThis as unknown as { crypto?: { randomUUID?: () => string } }).crypto;
if (c && typeof c.randomUUID === "function") return c.randomUUID();
} catch {}
} catch { }
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (ch) => {
const r = (Math.random() * 16) | 0;
const v = ch === "x" ? r : (r & 0x3) | 0x8;
@@ -420,7 +422,7 @@ export function AnnotateMode({ username, settings }: Props) {
// Hold a ref to the latest drawCanvas so the image-change effect can call
// it without subscribing to its identity (which flips on every `drawing` /
// `ann` / `overlayVisible` change and would reset state mid-interaction).
const drawCanvasRef = useRef<() => void>(() => {});
const drawCanvasRef = useRef<() => void>(() => { });
useEffect(() => {
drawCanvasRef.current = drawCanvas;
}, [drawCanvas]);
@@ -761,7 +763,7 @@ export function AnnotateMode({ username, settings }: Props) {
return (
classesRef.current[classId] ??
classes[classId] ??
`class_${classId}`
"Object"
);
}
@@ -940,10 +942,12 @@ export function AnnotateMode({ username, settings }: Props) {
setSelectedAnnId(null);
return;
}
if (activeClassId == null) {
setStatusMsg("Pick a class on the right first");
return;
}
// if (activeClassId == null) {
// setStatusMsg("Pick a class on the right first");
// return;
// }
const classId = activeClassId ?? DEFAULT_CLASS_ID;
e.stopPropagation(); // don't let the pan handler see this
const p = canvasToImageCoords(e.clientX, e.clientY);
if (!p) return;