159
Views
2
Comments
[Cropper Library] How do I leave the scale always square to crop the image?
Question
Forge component by Labs
5
Published on 02 Oct 2019

How do I leave the scale always square to crop the image?


Mobile

Staff
Rank: #76

Hi Eduardo,


You can use the Options parameter. In the description of the parameter there's a link to the component's documentation on github, and the part you're interested in is the options section.

The aspectRatio option should be the one you're interested in. I haven't tried it but I would expect setting it to 1 should do the trick.

I'm assuming you want to allow the crop box to be resized but stay square. If you don't want it to be resized try the cropBoxResizable option.


By the way, this is the general approach for OS components that use 3rd party JS libraries. Either the documentation link is present in the description of an element (module, block, parameter, etc) or you can find it in the comments at the beginning of the library's JS script.



No harm in asking of course, that's what we're here for, but if you know how you don't have to wait for an answer :)


Hope this helps. Let me know if it doesn't.


Cheers,

Daniel

Rank: #2281

Insert in the component of the cropper interface, in the Options parameter,


"{

     "" aspectRatio "": 1,

} "