Skip to content

Commit f64e8a1

Browse files
committed
style: reformat with prettier
1 parent 7ebbf71 commit f64e8a1

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

src/components/AnnotationCanvas.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function getClassName(classId: number): string {
2727
return CLASSES.find((c) => c.id === classId)?.name ?? 'unknown';
2828
}
2929

30-
3130
export default function AnnotationCanvas({
3231
image,
3332
isHelpOpen,
@@ -57,8 +56,18 @@ export default function AnnotationCanvas({
5756
const ctx = canvas.getContext('2d');
5857
if (!ctx) return;
5958

60-
const { zoom, panX, panY, annotations, boxOpacity, showLabels, hiddenClassIds, selectedId, activeClassId, editMode } =
61-
useAppStore.getState();
59+
const {
60+
zoom,
61+
panX,
62+
panY,
63+
annotations,
64+
boxOpacity,
65+
showLabels,
66+
hiddenClassIds,
67+
selectedId,
68+
activeClassId,
69+
editMode,
70+
} = useAppStore.getState();
6271
const dpr = window.devicePixelRatio || 1;
6372

6473
// Clear
@@ -110,10 +119,14 @@ export default function AnnotationCanvas({
110119
if (isSelected && editMode === 'select') {
111120
// Draw handles in screen space for consistent pixel size
112121
const handlePositions: [number, number][] = [
113-
[x, y], [x + w, y],
114-
[x, y + h], [x + w, y + h],
115-
[x + w / 2, y], [x + w / 2, y + h],
116-
[x, y + h / 2], [x + w, y + h / 2],
122+
[x, y],
123+
[x + w, y],
124+
[x, y + h],
125+
[x + w, y + h],
126+
[x + w / 2, y],
127+
[x + w / 2, y + h],
128+
[x, y + h / 2],
129+
[x + w, y + h / 2],
117130
];
118131

119132
ctx.save();
@@ -180,7 +193,10 @@ export default function AnnotationCanvas({
180193
rafId.current = requestAnimationFrame(draw);
181194
}, [draw]);
182195

183-
const { getDrawingState, getDragState, cancelDrawing, cancelDrag } = useCanvasInteraction(canvasRef, requestRedraw);
196+
const { getDrawingState, getDragState, cancelDrawing, cancelDrag } = useCanvasInteraction(
197+
canvasRef,
198+
requestRedraw,
199+
);
184200
useEffect(() => {
185201
getDrawingStateRef.current = getDrawingState;
186202
getDragStateRef.current = getDragState;

src/components/Toolbar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export default function Toolbar({ onToggleHelp }: ToolbarProps) {
2929
const allVisible = hiddenClassIds.size === 0;
3030

3131
return (
32-
<div className={`h-12 bg-white border-b border-gray-200 flex items-center px-4 gap-1 text-sm select-none ${isIdle ? 'pointer-events-none opacity-40' : ''}`}>
32+
<div
33+
className={`h-12 bg-white border-b border-gray-200 flex items-center px-4 gap-1 text-sm select-none ${isIdle ? 'pointer-events-none opacity-40' : ''}`}
34+
>
3335
{/* Mode switch */}
3436
<div className="flex items-center rounded-md bg-gray-100 p-0.5">
3537
<button

src/hooks/useCanvasInteraction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export interface DrawingState {
1313
currentY: number;
1414
}
1515

16-
1716
function hitTestHandle(
1817
ix: number,
1918
iy: number,

src/hooks/useKeyboardShortcuts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ function quickSaveJSON() {
1616
downloadJSON({ imageName, imageWidth, imageHeight, annotations });
1717
}
1818

19-
export function useKeyboardShortcuts({ cancelDrawing, cancelDrag, isHelpOpen, toggleHelp }: ShortcutActions) {
19+
export function useKeyboardShortcuts({
20+
cancelDrawing,
21+
cancelDrag,
22+
isHelpOpen,
23+
toggleHelp,
24+
}: ShortcutActions) {
2025
useEffect(() => {
2126
const onKeyDown = (e: KeyboardEvent) => {
2227
// Skip shortcuts when typing in input/textarea fields

src/store/useAppStore.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ export const useAppStore = create<AppState>((set) => ({
156156
moveAnnotation: (id, newBbox) =>
157157
set((state) => ({
158158
undoStack: [...state.undoStack, state.annotations],
159-
annotations: state.annotations.map((a) =>
160-
a.id === id ? { ...a, bbox: newBbox } : a
161-
),
159+
annotations: state.annotations.map((a) => (a.id === id ? { ...a, bbox: newBbox } : a)),
162160
})),
163161

164162
setImageInfo: (name, width, height) =>

0 commit comments

Comments
 (0)