Skip to content

Commit 4a2d461

Browse files
committed
Remove round
Limit to max width and height
1 parent 72fcd87 commit 4a2d461

File tree

2 files changed

+11
-11
lines changed
  • ts/WoltLabSuite/Core/Component/Image
  • wcfsetup/install/files/js/WoltLabSuite/Core/Component/Image

2 files changed

+11
-11
lines changed

ts/WoltLabSuite/Core/Component/Image/Cropper.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ abstract class ImageCropper {
222222
const maxHeight = maxWidth / this.configuration.aspectRatio;
223223

224224
if (
225-
Math.round(selection.width) < minWidth ||
226-
Math.round(selection.height) < minHeight ||
227-
Math.round(selection.width) > maxWidth ||
228-
Math.round(selection.height) > maxHeight
225+
selection.width < minWidth ||
226+
selection.height < minHeight ||
227+
selection.width > maxWidth ||
228+
selection.height > maxHeight
229229
) {
230230
event.preventDefault();
231231
}
@@ -260,8 +260,8 @@ abstract class ImageCropper {
260260
this.cropperSelection!.$change(
261261
0,
262262
0,
263-
this.maxSize.width * selectionRatio,
264-
this.maxSize.height * selectionRatio,
263+
Math.min(this.cropperCanvasRect.width, this.maxSize.width * selectionRatio),
264+
Math.min(this.cropperCanvasRect.height, this.maxSize.height * selectionRatio),
265265
this.configuration.aspectRatio,
266266
true,
267267
);

wcfsetup/install/files/js/WoltLabSuite/Core/Component/Image/Cropper.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)