[Question] How to get the cropper's width? #338
Replies: 1 comment 1 reply
-
The problem you're encountering is that the editor image automatically adjusts its size based on the aspect ratio of the image and the editor, functioning similarly to Currently, disabling the scale in the crop editor is not possible, and the editor always applies a padding of 20 around the image. Out of curiosity, what is the reason you want to display the crop area directly in the main editor? |
Beta Was this translation helpful? Give feedback.
-
I need to cover the cropping area in both the main editor and the Crop-Rotate-Editor with a custom widget.
Although I can retrieve the width of the image in the main editor, this doesn't help, as the image is scaled to fit the area based on its height rather than its width. As a result, I end up with different values when the image is tall versus when it is wide.
I wanted to solve the problem by adding padding to a Container equal to half of the screen width minus the image width in the main editor.
The question is: Is there a way to get the width of the image cropper? Or, how would you solve this issue?
It would also be great to disable scaling to fit the height in the main editor (since I need to cover that same area as well).
That’s what I’d like to achieve with all kinds of images, while also ensuring the exact same area is covered in the main editor.
It doesn’t seem to be accurate with a tall image:
![Screenshot_2025-01-27-01-00-58-68_01c49f19ecf1538923b8e3b20b6003d2](https://private-user-images.githubusercontent.com/97182034/406774233-c8a307fb-c4fd-42af-8d1f-82773173312a.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzYzNTQsIm5iZiI6MTczOTU3NjA1NCwicGF0aCI6Ii85NzE4MjAzNC80MDY3NzQyMzMtYzhhMzA3ZmItYzRmZC00MmFmLThkMWYtODI3NzMxNzMzMTJhLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzMzQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3OTA5Nzk1MmZiMzJhNTk2NWJhNzZmNDM5Mzc4ZGM0ZWE5NmY3OTM2OGRkMzBkOWYwMzY5MmYzNmUwMTNlN2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mba8L_18KU6yFok6N4TwiMcaEiu0ijnFwbKFMrkvzFo)
I need to cover the same area. (Right now, it’s not working because I’ve set the container’s padding to zero)
![Screenshot_2025-01-27-01-28-17-74_01c49f19ecf1538923b8e3b20b6003d2](https://private-user-images.githubusercontent.com/97182034/406774665-6217cf82-f7bb-43cf-96c0-2095d5777954.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzYzNTQsIm5iZiI6MTczOTU3NjA1NCwicGF0aCI6Ii85NzE4MjAzNC80MDY3NzQ2NjUtNjIxN2NmODItZjdiYi00M2NmLTk2YzAtMjA5NWQ1Nzc3OTU0LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzMzQxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMyNDYxZDBmNTIyNzU4YzczYzdmOWYzYWQ0ODAzM2QzNzA0YWMxYTI0NWM2MjQ1ZDJhM2Q2MDc0MmUyYTYzOWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fcxjcXinAkvbrboHVRHC70MzZPAeFK_VxaYJUT74dz8)
**Here is my code: **
Beta Was this translation helpful? Give feedback.
All reactions