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