diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 9dbdd5ecb2..9a8bdfe91a 100644
|
|
Cropper = View.extend(/** @lends wp.media.view.Cropper.prototype */{ |
9007 | 9007 | imgOptions = _.extend(imgOptions, { |
9008 | 9008 | parent: this.$el, |
9009 | 9009 | onInit: function() { |
9010 | | this.parent.children().on( 'mousedown touchstart', function( e ){ |
9011 | 9010 | |
9012 | | if ( e.shiftKey ) { |
| 9011 | // Store the set ratio. |
| 9012 | var setRatio = imgSelect.getOptions().aspectRatio; |
| 9013 | |
| 9014 | // On mousedown, If no ratio is set and the shift key is down, used a 1:1 ratio. |
| 9015 | this.parent.children().on( 'mousedown touchstart', function( e ) { |
| 9016 | |
| 9017 | // If no ratio is set and the shift key is down, used a 1:1 ratio. |
| 9018 | if ( ! setRatio && e.shiftKey ) { |
9013 | 9019 | imgSelect.setOptions( { |
9014 | 9020 | aspectRatio: '1:1' |
9015 | 9021 | } ); |
9016 | | } else { |
9017 | | imgSelect.setOptions( { |
9018 | | aspectRatio: false |
9019 | | } ); |
9020 | 9022 | } |
9021 | 9023 | } ); |
| 9024 | |
| 9025 | this.parent.children().on( 'mouseup touchend', function( e ) { |
| 9026 | |
| 9027 | // Restore the set ratio. |
| 9028 | imgSelect.setOptions( { |
| 9029 | aspectRatio: setRatio ? setRatio : false |
| 9030 | } ); |
| 9031 | } ); |
9022 | 9032 | } |
9023 | 9033 | } ); |
9024 | 9034 | this.trigger('image-loaded'); |
diff --git src/wp-includes/js/media/views/cropper.js src/wp-includes/js/media/views/cropper.js
index 4220729072..85ddcaf747 100644
|
|
Cropper = View.extend(/** @lends wp.media.view.Cropper.prototype */{ |
55 | 55 | imgOptions = _.extend(imgOptions, { |
56 | 56 | parent: this.$el, |
57 | 57 | onInit: function() { |
58 | | this.parent.children().on( 'mousedown touchstart', function( e ){ |
59 | 58 | |
60 | | if ( e.shiftKey ) { |
| 59 | // Store the set ratio. |
| 60 | var setRatio = imgSelect.getOptions().aspectRatio; |
| 61 | |
| 62 | // On mousedown, If no ratio is set and the shift key is down, used a 1:1 ratio. |
| 63 | this.parent.children().on( 'mousedown touchstart', function( e ) { |
| 64 | |
| 65 | // If no ratio is set and the shift key is down, used a 1:1 ratio. |
| 66 | if ( ! setRatio && e.shiftKey ) { |
61 | 67 | imgSelect.setOptions( { |
62 | 68 | aspectRatio: '1:1' |
63 | 69 | } ); |
64 | | } else { |
65 | | imgSelect.setOptions( { |
66 | | aspectRatio: false |
67 | | } ); |
68 | 70 | } |
69 | 71 | } ); |
| 72 | |
| 73 | this.parent.children().on( 'mouseup touchend', function( e ) { |
| 74 | |
| 75 | // Restore the set ratio. |
| 76 | imgSelect.setOptions( { |
| 77 | aspectRatio: setRatio ? setRatio : false |
| 78 | } ); |
| 79 | } ); |
70 | 80 | } |
71 | 81 | } ); |
72 | 82 | this.trigger('image-loaded'); |