Open nunoperalta opened 3 years ago
@nunoperalta you wrote (eventually got this figured out). Can you share how you fixed ? I am also looking in docs but can not find solution exactly. More code based working example could help.
Hey
I can't remember exactly, but here's what I have currently:
Jcrop.load('img-to-crop').then(function (img) {
var jcrop = Jcrop.attach(img);
var rect = Jcrop.Rect.create(x, y, w, h);
jcrop.newWidget(rect, { aspectRatio: rect.aspect });
...
jcrop.destroy();
});
The position can be accessed through jcrop.active.pos
In these examples:
https://jcrop.com/guide/widgets.html#creating-a-widget https://jcrop.com/guide/instance.html#newwidget-rect-options
I'm finding it really hard to get this working, and unfortunately the documentation is very confusing or incomplete. (eventually got this figured out)
Would be nice if the page at: https://jcrop.com/examples/ could have an example source code that I could copy from, as it seems to do exactly what I want.
I'm simply looking to put a default cropper active, centered to the image, with fixed aspect ratio.