Changeset 42595
- Timestamp:
- 01/24/2018 09:35:10 PM (7 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r42435 r42595 9169 9169 parent: this.$el, 9170 9170 onInit: function() { 9171 this.parent.children().on( 'mousedown touchstart', function( e ){ 9172 9173 if ( e.shiftKey ) { 9171 9172 // Store the set ratio. 9173 var setRatio = imgSelect.getOptions().aspectRatio; 9174 9175 // On mousedown, if no ratio is set and the Shift key is down, use a 1:1 ratio. 9176 this.parent.children().on( 'mousedown touchstart', function( e ) { 9177 9178 // If no ratio is set and the shift key is down, use a 1:1 ratio. 9179 if ( ! setRatio && e.shiftKey ) { 9174 9180 imgSelect.setOptions( { 9175 9181 aspectRatio: '1:1' 9176 9182 } ); 9177 } else {9178 imgSelect.setOptions( {9179 aspectRatio: false9180 } );9181 9183 } 9184 } ); 9185 9186 this.parent.children().on( 'mouseup touchend', function( e ) { 9187 9188 // Restore the set ratio. 9189 imgSelect.setOptions( { 9190 aspectRatio: setRatio ? setRatio : false 9191 } ); 9182 9192 } ); 9183 9193 } -
trunk/src/wp-includes/js/media/views/cropper.js
r41557 r42595 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, use 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, use 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: false67 } );68 70 } 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 } ); 69 79 } ); 70 80 }
Note: See TracChangeset
for help on using the changeset viewer.