52240083b3
- One crop_fill (default 0.9) replaces duplicated FILL in inventory/overlay - Thin localStorage settings store; crop % only moves long-axis end insets - Pure tapeGeometry: fixed stage line, stage↔image map, tick span → px - measure() prefers tape tick span for scale; maskSpanAlong demoted - rotateCalibration bakes cal tilt into inventory + overlay only - Fix stale 80%-fill comment on slabBounds
22 lines
701 B
TypeScript
22 lines
701 B
TypeScript
/**
|
|
* Shared crop constants for inventory PNG + tape-line overlay (#99).
|
|
* Aspect is fixed 3:4; crop_fill only moves the long-axis end insets.
|
|
* Non-retro: changing fill affects future encodes only, not stored PNGs.
|
|
*/
|
|
|
|
export const DEFAULT_CROP_FILL = 0.9;
|
|
export const ASPECT_W = 3;
|
|
export const ASPECT_H = 4;
|
|
export const FLOOR_PX = 800;
|
|
|
|
/** Fraction of the long axis inset from each end: (1 - fill) / 2. */
|
|
export function cropMarginFraction(fill: number = DEFAULT_CROP_FILL): number {
|
|
const f = clampFill(fill);
|
|
return (1 - f) / 2;
|
|
}
|
|
|
|
export function clampFill(fill: number): number {
|
|
if (!Number.isFinite(fill)) return DEFAULT_CROP_FILL;
|
|
return Math.min(1, Math.max(0.01, fill));
|
|
}
|