Skip to content

Commit 7d746c2

Browse files
committed
Custom button for crop action
1 parent 02687bc commit 7d746c2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

croppic.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
rotateControls: true,
3030
modal:false,
3131
customUploadButtonId:'',
32+
customCropButtonId: '',
3233
loaderHtml:'',
3334
scaleToFill: true,
3435
processInline: false,
@@ -401,7 +402,14 @@
401402
cropControlRotateRight = '<i class="cropControlRotateRight"></i>';
402403
}
403404

404-
html = '<div class="cropControls cropControlsCrop">'+ cropControlZoomMuchIn + cropControlZoomIn + cropControlZoomOut + cropControlZoomMuchOut + cropControlRotateLeft + cropControlRotateRight + cropControlCrop + cropControlReset + '</div>';
405+
if(that.options.customCropButtonId ==='') {
406+
html = '<div class="cropControls cropControlsCrop">'+ cropControlZoomMuchIn + cropControlZoomIn + cropControlZoomOut + cropControlZoomMuchOut + cropControlRotateLeft + cropControlRotateRight + cropControlCrop + cropControlReset + '</div>';
407+
} else {
408+
html = '<div class="cropControls cropControlsCrop">'+ cropControlZoomMuchIn + cropControlZoomIn + cropControlZoomOut + cropControlZoomMuchOut + cropControlRotateLeft + cropControlRotateRight + cropControlReset + '</div>';
409+
$('#'+that.options.customCropButtonId).on('click', function(){
410+
that.crop();
411+
});
412+
}
405413

406414
that.obj.append(html);
407415

0 commit comments

Comments
 (0)