fix(fe): auto-run the mask when the mask screen is active

The mask screen never populated its overlay: pickCalibration set overlay:null
and the only thing that computed it (approveMask) was gated behind the
Approve button, which is disabled until overlay.slabPx>0 - a chicken-and-egg,
so the preview stayed empty and Approve was permanently disabled. Auto-run
approveMask() whenever the mask screen is active (and on sheet/sensitivity
change) so the overlay and preview render immediately.
This commit is contained in:
2026-09-25 09:11:54 -07:00
parent 25c1f79fc1
commit e4a05dd468
+10 -1
View File
@@ -70,6 +70,13 @@
let fileInput: HTMLInputElement; let fileInput: HTMLInputElement;
// Auto-run the mask when entering the mask screen and whenever the sheet or
// sensitivity changes, so the overlay (and preview) is populated without the
// owner having to press Approve first.
$: if (kind === 'mask' && cap.source && cap.source.widthPx > 0) {
void session.approveMask();
}
function pickFiles(e: Event) { function pickFiles(e: Event) {
const input = e.target as HTMLInputElement; const input = e.target as HTMLInputElement;
if (!input.files) return; if (!input.files) return;
@@ -164,7 +171,9 @@
</label> </label>
</div> </div>
{/if} {/if}
{#if failed} {#if overlay && overlay.slabPx === 0}
<p class="err">No slab pixels detected — the mask removed everything. Lower the sensitivity, or set the sheet to match what the photo sits on, then retake if the shot is dark.</p>
{:else if failed}
<p class="err">No slab pixels detected. Adjust controls or retake.</p> <p class="err">No slab pixels detected. Adjust controls or retake.</p>
{:else if overlay} {:else if overlay}
<p>Mask settled: {overlay.slabPx} slab pixels.</p> <p>Mask settled: {overlay.slabPx} slab pixels.</p>