diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 29b56c66a8..0f3f4a2ebf 100644
|
|
Cropper = View.extend({ |
4412 | 4412 | }; |
4413 | 4413 | }, |
4414 | 4414 | onImageLoad: function() { |
4415 | | var imgOptions = this.controller.get('imgSelectOptions'); |
| 4415 | var imgOptions = this.controller.get('imgSelectOptions'), |
| 4416 | imgSelect; |
| 4417 | |
4416 | 4418 | if (typeof imgOptions === 'function') { |
4417 | 4419 | imgOptions = imgOptions(this.options.attachment, this.controller); |
4418 | 4420 | } |
4419 | 4421 | |
4420 | | imgOptions = _.extend(imgOptions, {parent: this.$el}); |
| 4422 | imgOptions = _.extend(imgOptions, { |
| 4423 | parent: this.$el, |
| 4424 | onInit: function( img ) { |
| 4425 | this.parent.children().on( 'mousedown touchstart', function( e ){ |
| 4426 | |
| 4427 | if ( e.shiftKey ) { |
| 4428 | imgSelect.setOptions( { |
| 4429 | aspectRatio: '1:1' |
| 4430 | } ); |
| 4431 | } else { |
| 4432 | imgSelect.setOptions( { |
| 4433 | aspectRatio: false |
| 4434 | } ); |
| 4435 | } |
| 4436 | } ); |
| 4437 | } |
| 4438 | } ); |
4421 | 4439 | this.trigger('image-loaded'); |
4422 | | this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
| 4440 | imgSelect = this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
4423 | 4441 | }, |
4424 | 4442 | onError: function() { |
4425 | 4443 | 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 9eb75c3f53..71d60ceb06 100644
|
|
Cropper = View.extend({ |
48 | 48 | imgOptions = imgOptions(this.options.attachment, this.controller); |
49 | 49 | } |
50 | 50 | |
51 | | imgOptions = _.extend(imgOptions, {parent: this.$el}); |
| 51 | imgOptions = _.extend(imgOptions, { |
| 52 | parent: this.$el, |
| 53 | onInit: function( img ) { |
| 54 | this.parent.children().on( 'mousedown touchstart', function( e ){ |
| 55 | |
| 56 | if ( e.shiftKey ) { |
| 57 | imgSelect.setOptions( { |
| 58 | aspectRatio: '1:1' |
| 59 | } ); |
| 60 | } else { |
| 61 | imgSelect.setOptions( { |
| 62 | aspectRatio: false |
| 63 | } ); |
| 64 | } |
| 65 | } ); |
| 66 | } |
| 67 | } ); |
52 | 68 | this.trigger('image-loaded'); |
53 | 69 | this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
54 | 70 | }, |