Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jcrop setSelect problem

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!!

like image 226
luqita Avatar asked Apr 07 '11 01:04

luqita


1 Answers

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]);
like image 178
luqita Avatar answered Sep 19 '22 05:09

luqita