Cropping regression fix v2
This commit is contained in:
@@ -245,12 +245,12 @@
|
|||||||
centerX = Math.max(cropWidth/2, Math.min(centerX, img.naturalWidth - cropWidth/2));
|
centerX = Math.max(cropWidth/2, Math.min(centerX, img.naturalWidth - cropWidth/2));
|
||||||
centerY = Math.max(cropHeight/2, Math.min(centerY, img.naturalHeight - cropHeight/2));
|
centerY = Math.max(cropHeight/2, Math.min(centerY, img.naturalHeight - cropHeight/2));
|
||||||
|
|
||||||
const cropX = Math.round(centerX - cropWidth/2);
|
const cropX = centerX - cropWidth/2;
|
||||||
const cropY = Math.round(centerY - cropHeight/2);
|
const cropY = centerY - cropHeight/2;
|
||||||
|
|
||||||
const crop = {
|
const crop = {
|
||||||
x: Math.max(0, cropX),
|
x: Math.round(Math.max(0, cropX)),
|
||||||
y: Math.max(0, cropY),
|
y: Math.round(Math.max(0, cropY)),
|
||||||
width: Math.round(cropWidth),
|
width: Math.round(cropWidth),
|
||||||
height: Math.round(cropHeight)
|
height: Math.round(cropHeight)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user