web: the histogram opens top-left, and CLEAR asks before it forgets

The histogram used to park itself in the top-right corner on the first
paint; it now starts at the top-left of the photo and is dragged from
there, the way the rest of the overlay is. Nothing else changed in it —
same drag, same clamping, same resize.

The stage also gains a CLEAR button, sitting before the picker button,
which is now OPEN PHOTO. CLEAR takes the photo off the stage, but not
before asking: SAVE PHOTO files it first and only then clears, EXPORT
IMAGE writes the JPEG and then clears, CLEAR WITHOUT SAVING drops it
there and then, and CANCEL leaves everything alone. Saving from that
modal resumes the clear once the file has really landed — a guest, a
capped account or a cancelled name prompt never loses the frame.

Clearing forgets the working photo (source, preview, GPS, ISO, and the
IndexedDB copy session.ts now deletes), while the look, the crop and the
undo history stay put, so the next photo opens on the same settings the
way replacing a photo already did.
This commit is contained in:
2026-09-22 08:56:58 +07:00
parent 59d90ae068
commit f9a40a9e1c
7 changed files with 183 additions and 26 deletions
+11
View File
@@ -93,6 +93,17 @@ export async function loadPhoto(): Promise<{ name: string; bytes: Uint8Array } |
}
}
// CLEAR takes the working photo off the stage but keeps the knobs: the look was
// the user's work and outlives the picture it was made on. The session's own
// copy has to go with it, or the next reload would put the frame straight back.
export async function forgetPhoto(): Promise<void> {
try {
await idb('readwrite', (s) => s.delete(PHOTO_KEY));
} catch {
// Private mode / no IndexedDB: the photo just will not survive a reload.
}
}
// Signing out ends the session: drop the knobs and the working photo, so the
// next visit — guest or another account — opens the studio empty. The account's
// own photos stay in MY PHOTOS, ready to reopen.