[Cropper Mobile] How do I leave the scale always square to crop the image?

[Cropper Mobile] How do I leave the scale always square to crop the image?

  
Forge Component
(3)
Published on 11 Oct (10 days ago) by Labs
3 votes
Published on 11 Oct (10 days ago) by Labs

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


Mobile

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

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


"{

     "" aspectRatio "": 1,

} "