Cropping regression fix v2

This commit is contained in:
Roman Krček
2025-07-18 09:36:14 +02:00
parent ceececfd99
commit e8dcb700b5

View File

@@ -245,12 +245,12 @@
centerX = Math.max(cropWidth/2, Math.min(centerX, img.naturalWidth - cropWidth/2));
centerY = Math.max(cropHeight/2, Math.min(centerY, img.naturalHeight - cropHeight/2));
const cropX = Math.round(centerX - cropWidth/2);
const cropY = Math.round(centerY - cropHeight/2);
const cropX = centerX - cropWidth/2;
const cropY = centerY - cropHeight/2;
const crop = {
x: Math.max(0, cropX),
y: Math.max(0, cropY),
x: Math.round(Math.max(0, cropX)),
y: Math.round(Math.max(0, cropY)),
width: Math.round(cropWidth),
height: Math.round(cropHeight)
};