jcrop setSelect problem

luqita picture luqita · Apr 7, 2011 · Viewed 8.9k times · Source

I am having a small issue with setSelect and I cannot figure it out.

I have a code that looks like this:

jQuery('#cropbox1').Jcrop({ 
    setSelect:   [ 157,86,37,49 ],  
    aspectRatio: 151 / 200,
    onChange:    showCoords1,
    onSelect:    showCoords1
    });

However the small box with the cropping is clearly not showing at those positions (for example the 'x' position shown there is 157, but my image is only 300 in width and hence the crop box should appear after half of it, and it's appearing at the start of it.

Any ideas on what could be the problem??

Thank you!!

Answer

luqita picture luqita · Apr 10, 2011

Solved, in case anyone has this problem, the third and fourth values in the setSelect params mean the second x and y positions (not the width and height from the first point).

Here's an example that should help illustrate this:

jcrop_api.setSelect([crop.left, crop.top, crop.left + crop.width, crop.top + crop.height]);