Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CropArea size #580

Open
gabezimmermann opened this issue Jan 17, 2025 · 1 comment
Open

CropArea size #580

gabezimmermann opened this issue Jan 17, 2025 · 1 comment

Comments

@gabezimmermann
Copy link

Hello, I am facing a difficulty in leaving the CropArea, occupying the horizontal space of the modal.

I see that it calculates the size of the CropArea based on the height of the image within the height of the modal.

Is there any way to make it ignore this height and let the CropArea occupy the entire width?

<div className="relative w-full h-[500px]">
                            {state.isReady === true && (
                                <Cropper
                                    image={src}
                                    crop={state.cropper.crop}
                                    zoom={state.cropper.zoom}
                                    style={{
                                        cropAreaStyle: {
                                            border: '4px solid rgb(29, 155, 240)'
                                        }
                                    }}
                                    cropShape='rect'
                                    restrictPosition={true}
                                    zoomSpeed={0.1}
                                    objectFit='contain'
                                    aspect={state.aspectRatio.width / state.aspectRatio.height}
                                    onCropChange={setCrop}
                                    onZoomChange={setZoom}
                                    onCropComplete={(newCropArea) => {
                                        setCroppedArea(newCropArea)
                                    }}
                                />
                            )}
                        </div>

Image

@ValentinH
Copy link
Owner

Have you tried using a different option for the objectFit property?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants