-
Great work on the lib, congrats! I have a use case where I'd like to use the crop information, that I'm now exporting as: // This follows the "live output" example
const scale = 100 / cropArea.width;
onSubmit({
x: -cropArea.x * scale,
y: -cropArea.y * scale,
scale
}); These values are exploitable when we want to display the image inside a div ( I have a use case where I want to display the image like so: <div
style={{
background: `url(${url}) ${x}px ${y}px / ${scale}%` But it turns out this isn't straightforward because the values provided by the I've started reading the codebase to understand how these values are computed in order to set them as top/left offsets so that the object-position works for me. This issue also affects the scale. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The information about Is it helpful? |
Beta Was this translation helpful? Give feedback.
-
Here's a working solution that should match your needs: https://codesandbox.io/embed/react-easy-crop-with-live-output-forked-1yrsgv This works for horizontal images. You might have to change the background size values for horizontal images. |
Beta Was this translation helpful? Give feedback.
Here's a working solution that should match your needs: https://codesandbox.io/embed/react-easy-crop-with-live-output-forked-1yrsgv
This works for horizontal images. You might have to change the background size values for horizontal images.