Skip to content

Commit c03add9

Browse files
authored
Merge pull request #4242 from Laravel-Backpack/pr/4200
#4200 add cropend event to image fields
2 parents 75848a4 + 5b2a1b8 commit c03add9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/resources/views/crud/fields/base64_image.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,27 @@ function bpFieldInitBase64CropperImageElement(element) {
238238
if(crop) {
239239
$rotateLeft.click(function() {
240240
$mainImage.cropper("rotate", 90);
241+
$mainImage.trigger('cropend');
241242
});
242243
243244
$rotateRight.click(function() {
244245
$mainImage.cropper("rotate", -90);
246+
$mainImage.trigger('cropend');
245247
});
246248
247249
$zoomIn.click(function() {
248250
$mainImage.cropper("zoom", 0.1);
251+
$mainImage.trigger('cropend');
249252
});
250253
251254
$zoomOut.click(function() {
252255
$mainImage.cropper("zoom", -0.1);
256+
$mainImage.trigger('cropend');
253257
});
254258
255259
$reset.click(function() {
256260
$mainImage.cropper("reset");
261+
$mainImage.trigger('cropend');
257262
});
258263
}
259264
}

src/resources/views/crud/fields/image.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,27 @@ function bpFieldInitCropperImageElement(element) {
283283
if(crop) {
284284
$rotateLeft.click(function() {
285285
$mainImage.cropper("rotate", 90);
286+
$mainImage.trigger('cropend');
286287
});
287288
288289
$rotateRight.click(function() {
289290
$mainImage.cropper("rotate", -90);
291+
$mainImage.trigger('cropend');
290292
});
291293
292294
$zoomIn.click(function() {
293295
$mainImage.cropper("zoom", 0.1);
296+
$mainImage.trigger('cropend');
294297
});
295298
296299
$zoomOut.click(function() {
297300
$mainImage.cropper("zoom", -0.1);
301+
$mainImage.trigger('cropend');
298302
});
299303
300304
$reset.click(function() {
301305
$mainImage.cropper("reset");
306+
$mainImage.trigger('cropend');
302307
});
303308
}
304309
}

0 commit comments

Comments
 (0)