move image, edit image

This commit is contained in:
2024-12-07 21:29:51 +01:00
parent 92ec07fe75
commit 26518bef56
9 changed files with 193 additions and 57 deletions

View File

@@ -16,6 +16,7 @@ export class UploadImageModalComponent implements AfterViewInit, OnDestroy {
@Output() imageUploaded = new EventEmitter<{ imageSrc: string | ArrayBuffer | null | undefined, deckImage:DeckImage }>();
@ViewChild('uploadImageModal') modalElement!: ElementRef;
@ViewChild('imageFile') imageFileElement!: ElementRef;
imageFile: File | null = null;
processingStatus: string = '';
@@ -90,7 +91,7 @@ export class UploadImageModalComponent implements AfterViewInit, OnDestroy {
});
const deckImage:DeckImage={name:bildname,id:bildid,boxes}
this.imageUploaded.emit({ imageSrc, deckImage });
this.resetFileInput();
// Schließe das Upload-Modal
this.closeModal();
} catch (error) {
@@ -101,4 +102,12 @@ export class UploadImageModalComponent implements AfterViewInit, OnDestroy {
};
reader.readAsDataURL(file);
}
/**
* Setzt das Datei-Input-Feld zurück, sodass dieselbe Datei erneut ausgewählt werden kann.
*/
resetFileInput(): void {
if (this.imageFileElement && this.imageFileElement.nativeElement) {
this.imageFileElement.nativeElement.value = '';
}
}
}