Open GoogleCodeExporter opened 9 years ago
I figured out if i change getFixed to the following, it works (this is not
optimized
by any means). Also I'm not sure if copying and pasting the code in will mess
with
the formatting.
function getFixed()
{
if (!options.aspectRatio && !aspectLock) return getRect();
// This function could use some optimization I think...
var aspect = options.aspectRatio ? options.aspectRatio : aspectLock,
min = options.minSize,
max = options.maxSize,
rw = x2 - x1,
rh = y2 - y1,
rwa = Math.abs(rw),
rha = Math.abs(rh),
real_ratio = rwa / rha,
xx, yy
;
if (real_ratio < aspect)
{
yy = y2;
w = rha * aspect;
xx = rw < 0 ? x1 - w : w + x1;
rwa = Math.abs(xx-x1)
h = rwa / aspect;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
if (xx < 0)
{
xx = 0;
h = Math.abs((xx - x1) / aspect);
yy = rh < 0 ? y1 - h: h + y1;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
}
else if (xx > boundx)
{
xx = boundx;
h = Math.abs((xx - x1) / aspect);
yy = rh < 0 ? y1 - h : h + y1;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
}
}
else
{
xx = x2;
h = rwa / aspect;
yy = rh < 0 ? y1 - h : y1 + h;
rha = Math.abs(yy-y1)
w = rha * aspect;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
if (yy < 0)
{
yy = 0;
w = Math.abs((yy - y1) * aspect);
xx = rw < 0 ? x1 - w : w + x1;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
}
else if (yy > boundy)
{
yy = boundy;
w = Math.abs(yy - y1) * aspect;
xx = rw < 0 ? x1 - w : w + x1;
//new//
if(xmin && (rwa < xmin))
xx = (rw > 0) ? (x1 + xmin) : (x1 - xmin);
if(ymin && (rha < ymin))
yy = (rh > 0) ? (y1 + ymin) : (y1 - ymin);
//end new//
}
}
return last = makeObj(flipCoords(x1,y1,xx,yy));
};
Original comment by eski...@gmail.com
on 13 Jan 2009 at 4:48
even i am getting the same issue
Original comment by a.saan...@gmail.com
on 2 Jun 2010 at 11:22
For me it only happens when I init jcrop with setSelect. Sadly I need the
setSelect property.
This works:
$('#cropbox').Jcrop({
trueSize: [1024, 768],
aspectRatio: previewAspect,
allowSelect: true,
minSize: [640, 300],
maxSize: [1024, 768],
/*setSelect: [10, 10, 380, 140],*/
onChange: showPreview,
onSelect: showPreview
});
Using .98
Original comment by christof...@gmail.com
on 23 Jun 2010 at 10:06
I just fixed it by moving this block down (just before Selection.refresh();):
if ('setSelect' in options) {
setSelect(opt.setSelect);
Selection.done();
delete(options.setSelect);
}
Original comment by christof...@gmail.com
on 23 Jun 2010 at 10:16
Original issue reported on code.google.com by
eski...@gmail.com
on 13 Jan 2009 at 4:45