Skip to content

Commit

Permalink
[BUGFIX] Fix wrong GUI crop area placement on edge cases
Browse files Browse the repository at this point in the history
In the image editor, the "Cropped area" was configured with a `ceil`ed
width and height. Since all other dimensions are `floor`ed, this might
cause an overlap.
Due to the configured cropping mode, defining that the cropping area
must never exceed the image dimensions, the cropper library places the
cropper to a position that's mathematically correct but not desired.

To solve this issue, the `width` and `height` properties fed to the
cropper are now `floor`ed as well, basically aligning with the rest of
the coordinates.

Resolves: #101520
Releases: main, 12.4, 11.5
Change-Id: I981bd185eaf0db60662a5a6b7b423d84112c2150
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83659
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
  • Loading branch information
andreaskienast committed Apr 4, 2024
1 parent e20cdfd commit 0d1da60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Build/Sources/TypeScript/backend/image-manipulation.ts
Expand Up @@ -444,8 +444,8 @@ class ImageManipulation {

const minCroppedWidth = 15;
const minCroppedHeight = 15;
let width = Math.ceil(e.detail.width);
let height = Math.ceil(e.detail.height);
let width = Math.floor(e.detail.width);
let height = Math.floor(e.detail.height);

if (width < minCroppedWidth || height < minCroppedHeight) {
width = Math.max(minCroppedHeight, height);
Expand Down

0 comments on commit 0d1da60

Please sign in to comment.