ValentinH / svelte-easy-crop

A Svelte component to crop images with easy interactions
https://codesandbox.io/s/svelte-easy-crop-basic-demo-q1005?file=/App.svelte
MIT License
188 stars 28 forks source link

Start the cropper with cropdata #57

Open Matthijz98 opened 5 days ago

Matthijz98 commented 5 days ago

I want to mount the cropper with the crop settings that the users saved before. The crop results are saved and returned by my api.

But the crop property only accepts x and y not height and width.

Expected behavior The crop property can accept a value like this:

{"width": 2617, "height": 2617, "x": 848, "y": 568}

The cropper uses these values as the start values

ValentinH commented 5 days ago

I think that what you are looking for is the same as the initialCroppedAreaPercentages/initialCroppedAreaPixels of react-easy-crop. If you are interested to contribute this feature, feel free to check the React implementation and port it to the Svelte one. I'd be happy to review the PR 🙂