google-code-export / jcrop

Automatically exported from code.google.com/p/jcrop
1 stars 0 forks source link

trueSize does not work on chrome/safari browsers #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. specify trueSize property on styled/resized image.

Expect passing true image dimensions to trueSize property calculates difference 
and outputs correct coordinates for crop. Works in Firefox, Opera, and IE but 
not in Google Chrome or Safari. Instead zeros are returned for the coordinates.

Jcrop v0.9.8
jQuery v1.4.4 
Chrome 8.0.552.224
Safari 5.0.3

code initializing jcrop
$(function() {
var api;
        var opt = {
            onSelect: storeCoords,
            onChange: storeCoords,
            bgColor: '#EEEEEE',
            trueSize: [w, h],
            bgOpacity: .7
        };

        $('#crop_button').click(function() {
            api = $.Jcrop(orimg, opt);
        });
});
function storeCoords(c)
{
    $('#X').val(c.x);
    $('#Y').val(c.y);
    $('#W').val(c.w);
    $('#H').val(c.h);
}

More details on question posted on Stackoverflow: 
http://stackoverflow.com/questions/4664810/jcrop-coordinates-in-safari-and-chrom
e-overwritten

Original issue reported on code.google.com by kayda...@gmail.com on 13 Jan 2011 at 9:22

GoogleCodeExporter commented 9 years ago
This is still an issue as of Chrome 25 and Safari 6.0.2.
If you change it to directly address the jQuery Object with the Selector you 
need, then it works for me.
So use $(orimg).Jcrop(opt); instead of $.Jcrop(orimg, opt);

Hope it hopes someone else.
A real pitty to see that all the issues here are not handled at all.

Original comment by hoellede...@gmail.com on 6 Mar 2013 at 11:11