cd52a2f82f
Browser-based photo catalog with an optional team server (SQLite + LibRaw). Local database, uploaded photos, build output and dependencies are gitignored. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
35 lines
786 B
TypeScript
35 lines
786 B
TypeScript
/**
|
|
* Drag payloads live in a module variable because browsers only expose
|
|
* `dataTransfer.getData` on drop, not during dragover — and we need to know
|
|
* whether a photo (rather than an OS file) is being dragged while hovering.
|
|
*/
|
|
|
|
let photoIds: string[] = [];
|
|
let eventId: string | null = null;
|
|
|
|
export const PHOTO_DRAG = 'application/x-lumen-photos';
|
|
export const EVENT_DRAG = 'application/x-lumen-event';
|
|
|
|
export function startPhotoDrag(ids: string[]) {
|
|
photoIds = ids;
|
|
eventId = null;
|
|
}
|
|
|
|
export function draggedPhotoIds(): string[] {
|
|
return photoIds;
|
|
}
|
|
|
|
export function startEventDrag(id: string) {
|
|
eventId = id;
|
|
photoIds = [];
|
|
}
|
|
|
|
export function draggedEventId(): string | null {
|
|
return eventId;
|
|
}
|
|
|
|
export function endDrag() {
|
|
photoIds = [];
|
|
eventId = null;
|
|
}
|