Closed A-wakil closed 10 months ago
React.useEffect(() => {
// Update the size of the crop window based on the new image bounds
let newSize = { width: 0, height: 0 };
const { width, height } = imageBounds;
const imageAspectRatio = width / height;
// Then check if the cropping aspect ratio is smaller
if (fixedAspectRatio < imageAspectRatio) {
// If so calculate the size so its not greater than the image width
newSize.height = height;
newSize.width = height * fixedAspectRatio;
} else {
// else, calculate the size so its not greater than the image height
newSize.width = width - 20;
newSize.height = width / fixedAspectRatio;
}
// Set the size of the crop overlay
setCropSize(newSize);
setAccumluatedPan({ x:10, y: 300 }); // Set your desired initial position here
}, [imageBounds]);
Is there a way to set the initial position of the crop overlay? rather than it just being at the top of the page? I tried multiple iterations on the
ImageCropOverlay.tsx
page but nothing really works.