Skip to content

Commit

Permalink
Merge branch 'file-upload-image-crop' into 6.2-user-coverphoto
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyperghost committed Dec 6, 2024
2 parents 592b293 + a9d93bf commit dab00bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions ts/WoltLabSuite/Core/Component/Image/Cropper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,13 @@ class MinMaxImageCropper extends ImageCropper {

protected centerSelection(): void {
this.cropperImage!.$center("contain");
this.#cropperCanvasRect = this.cropperImage!.getBoundingClientRect();

const { width: imageWidth } = this.cropperImage!.getBoundingClientRect();

this.cropperSelection!.$change(0, 0, imageWidth, 0, this.configuration.aspectRatio, true);
if (this.configuration.aspectRatio >= 1.0) {
this.cropperSelection!.$change(0, 0, this.#cropperCanvasRect.width, 0, this.configuration.aspectRatio, true);
} else {
this.cropperSelection!.$change(0, 0, 0, this.#cropperCanvasRect.height, this.configuration.aspectRatio, true);
}
this.cropperSelection!.$center();
this.cropperSelection!.scrollIntoView({ block: "center", inline: "center" });
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dab00bf

Please sign in to comment.