JCrop: prevent deselection?

I am currently adjusting the cropping sequence of the image.

The application requires a minimum minimum size, however this leads to inconvenient JCrop behavior:

  • Clicking without dragging produces nothing.
  • Clicking and slightly dragging immediately selects the minimum height.

One possible solution would be to solve the above problems:

  • The interface opens by default.
  • The selection cannot be deselected.

JCrop has built-in functions for selecting by default, however I have not yet defined built-in configuration / behavior to prevent deselection.

Attempts so far -

I tried this route

$.Jcrop.defaults.onRelease = function(e) { e.preventDefault(); e.stopPropagation(); } 

I also tried modifying the plugin source in several places to short circuit the functions that (possibly) perform de-selection by returning when opening these function definitions:

doneSelect Selection.release Selection.done

... without the desired result.

Any tips?

+8
jquery image-processing jcrop
source share
4 answers

Since I could not find a valid modification for jCrop to prevent deselection, I went instead of the YUI ImageCropper , which ships with both the necessary functions.

0
source share

Set allowSelect: false, to clarify the details: https://github.com/tapmodo/Jcrop/issues/5#issuecomment-1801926 .

+23
source share

allowSelect now available

+1
source share

I saw this on github and it helps.

 $('#cropbox').Jcrop({ onSelect : updateCoords, bgColor : 'transparent', bgOpacity : .2, setSelect : [ 0, 0, 700, 300 ], minSize : [700, 300], allowSelect : false, onRelease : releaseCheck }); }); function releaseCheck() { this.setOptions({ setSelect: [0,0,700,300] }); } 

https://github.com/tapmodo/Jcrop/issues/5#issuecomment-1801926

0
source share

All Articles