Changeset 42596
- Timestamp:
- 01/24/2018 09:40:09 PM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/js/media-views.js
r41937 r42596 8958 8958 parent: this.$el, 8959 8959 onInit: function() { 8960 this.parent.children().on( 'mousedown touchstart', function( e ){ 8961 8962 if ( e.shiftKey ) { 8960 8961 // Store the set ratio. 8962 var setRatio = imgSelect.getOptions().aspectRatio; 8963 8964 // On mousedown, if no ratio is set and the Shift key is down, use a 1:1 ratio. 8965 this.parent.children().on( 'mousedown touchstart', function( e ) { 8966 8967 // If no ratio is set and the shift key is down, use a 1:1 ratio. 8968 if ( ! setRatio && e.shiftKey ) { 8963 8969 imgSelect.setOptions( { 8964 8970 aspectRatio: '1:1' 8965 8971 } ); 8966 } else {8967 imgSelect.setOptions( {8968 aspectRatio: false8969 } );8970 8972 } 8973 } ); 8974 8975 this.parent.children().on( 'mouseup touchend', function( e ) { 8976 8977 // Restore the set ratio. 8978 imgSelect.setOptions( { 8979 aspectRatio: setRatio ? setRatio : false 8980 } ); 8971 8981 } ); 8972 8982 } -
branches/4.9/src/wp-includes/js/media/views/cropper.js
r41557 r42596 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.