Rework scan screen, make lookups non-blocking, fix review findings
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
468cafc6db
commit
b5defb4e4f
46 files changed
+1957
-406
No files matched your search
@@ -0,0 +1,15 @@
|
||||
/** Where the barcode is expected, as fractions of the video frame. The overlay box is drawn from the same numbers. */
|
||||
export const TARGET = { x: 0.1, y: 0.27, w: 0.8, h: 0.46 };
|
||||
|
||||
export interface Rect { x: number; y: number; w: number; h: number }
|
||||
|
||||
/** The target box in pixels of a frame of the given size. */
|
||||
export function cropRect(width: number, height: number): Rect {
|
||||
const x = Math.round(width * TARGET.x), y = Math.round(height * TARGET.y);
|
||||
return { x, y, w: Math.min(width - x, Math.round(width * TARGET.w)), h: Math.min(height - y, Math.round(height * TARGET.h)) };
|
||||
}
|
||||
|
||||
/** A small crop is enlarged so that thin bars cover enough pixels for the decoder: 2x below 1000 px wide. */
|
||||
export function upscaleFor(cropWidth: number): number {
|
||||
return cropWidth < 1000 ? 2 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user