fix preview

This commit is contained in:
JesmoDev
2024-05-16 15:42:05 +02:00
parent abd3e9a716
commit 6c842ea7a1

View File

@@ -33,11 +33,7 @@ export class UmbImageCropperPreviewElement extends LitElement {
if (!this.crop) return;
await this.updateComplete; // Wait for the @query to be resolved
if (!this.imageElement.complete) {
// Wait for the image to load
await new Promise((resolve) => (this.imageElement.onload = () => resolve(this.imageElement)));
}
await new Promise((resolve) => (this.imageElement.onload = () => resolve(this.imageElement)));
const container = this.imageContainerElement.getBoundingClientRect();
const cropAspectRatio = this.crop.width / this.crop.height;