diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index b42140166c..18e6444691 100644
|
|
Cropper = View.extend(/** @lends wp.media.view.Cropper.prototype */{ |
4523 | 4523 | }; |
4524 | 4524 | }, |
4525 | 4525 | onImageLoad: function() { |
4526 | | var imgOptions = this.controller.get('imgSelectOptions'); |
| 4526 | var imgOptions = this.controller.get('imgSelectOptions'), |
| 4527 | imgSelect; |
| 4528 | |
4527 | 4529 | if (typeof imgOptions === 'function') { |
4528 | 4530 | imgOptions = imgOptions(this.options.attachment, this.controller); |
4529 | 4531 | } |
4530 | 4532 | |
4531 | | imgOptions = _.extend(imgOptions, {parent: this.$el}); |
| 4533 | imgOptions = _.extend(imgOptions, { |
| 4534 | parent: this.$el, |
| 4535 | onInit: function() { |
| 4536 | this.parent.children().on( 'mousedown touchstart', function( e ){ |
| 4537 | |
| 4538 | if ( e.shiftKey ) { |
| 4539 | imgSelect.setOptions( { |
| 4540 | aspectRatio: '1:1' |
| 4541 | } ); |
| 4542 | } else { |
| 4543 | imgSelect.setOptions( { |
| 4544 | aspectRatio: false |
| 4545 | } ); |
| 4546 | } |
| 4547 | } ); |
| 4548 | } |
| 4549 | } ); |
4532 | 4550 | this.trigger('image-loaded'); |
4533 | | this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
| 4551 | imgSelect = this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
4534 | 4552 | }, |
4535 | 4553 | onError: function() { |
4536 | 4554 | var filename = this.options.attachment.get('filename'); |
diff --git src/wp-includes/js/media/views/cropper.js src/wp-includes/js/media/views/cropper.js
index 90012552d4..4220729072 100644
|
|
Cropper = View.extend(/** @lends wp.media.view.Cropper.prototype */{ |
45 | 45 | }; |
46 | 46 | }, |
47 | 47 | onImageLoad: function() { |
48 | | var imgOptions = this.controller.get('imgSelectOptions'); |
| 48 | var imgOptions = this.controller.get('imgSelectOptions'), |
| 49 | imgSelect; |
| 50 | |
49 | 51 | if (typeof imgOptions === 'function') { |
50 | 52 | imgOptions = imgOptions(this.options.attachment, this.controller); |
51 | 53 | } |
52 | 54 | |
53 | | imgOptions = _.extend(imgOptions, {parent: this.$el}); |
| 55 | imgOptions = _.extend(imgOptions, { |
| 56 | parent: this.$el, |
| 57 | onInit: function() { |
| 58 | this.parent.children().on( 'mousedown touchstart', function( e ){ |
| 59 | |
| 60 | if ( e.shiftKey ) { |
| 61 | imgSelect.setOptions( { |
| 62 | aspectRatio: '1:1' |
| 63 | } ); |
| 64 | } else { |
| 65 | imgSelect.setOptions( { |
| 66 | aspectRatio: false |
| 67 | } ); |
| 68 | } |
| 69 | } ); |
| 70 | } |
| 71 | } ); |
54 | 72 | this.trigger('image-loaded'); |
55 | | this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
| 73 | imgSelect = this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
56 | 74 | }, |
57 | 75 | onError: function() { |
58 | 76 | var filename = this.options.attachment.get('filename'); |