tapmodo / Jcrop

Jcrop - The Javascript Image Cropping Engine
https://jcrop.com
Other
4.31k stars 939 forks source link

double-click/tap to crop #30

Closed MarcusJT closed 12 years ago

MarcusJT commented 12 years ago

Please support for a double-click/tap event handler on the cropped area (not the rest of the image) which could then be hooked into to execute the crop/etc.

tapmodo commented 12 years ago

Hi. My apologies for taking a few weeks to get back to you on this. Despite no mention in the documentation, there is an 'onDblClick' option that fires (as I understand it) in the case you describe. If that does what you need, please close the issue. Thanks!

MarcusJT commented 12 years ago

Aha! Thanks, will test later today and close if it performs as expected!

MarcusJT commented 12 years ago

Apologies for my delay, have just tested 'onDblClick' and it works exactly as expected, thanks!

Ghostavio commented 11 years ago

Hello, I'm using the onDblClick method and it works perfectly on any computer, but it doesn't works on my iPad (I haven't tested other mobile OS, but I assume it doesn't work on any kind of touch). Is there any touch event to handle it?

aq1018 commented 11 years ago

onDblClick event doesn't return the true size of the image, but rather returns the scaled size

azaroth42 commented 10 years ago

aq1018, and anyone else who comes to the page...

The following works for me:

    jQuery(function($) {
        $('#image').Jcrop({
            onDblClick: function() { c = jcrop_api.tellSelect(); saveCoords(c); $("#button").click();},
            onSelect: saveCoords, 
            trueSize: [realWidth, realHeight]},
            function(){jcrop_api = this;});
    });