Ticket #36318: 36318.3.diff
File 36318.3.diff, 2.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/media/controllers/customize-image-cropper.js
14 14 CustomizeImageCropper = Controller.Cropper.extend({ 15 15 doCrop: function( attachment ) { 16 16 var cropDetails = attachment.get( 'cropDetails' ), 17 control = this.get( 'control' ); 17 control = this.get( 'control' ), 18 ratio = cropDetails.width / cropDetails.height; 18 19 19 if ( ! control.params.flex_width ) { 20 cropDetails.dst_width = control.params.width; 21 } 22 if ( ! control.params.flex_height ) { 23 cropDetails.dst_height = control.params.height; 20 // Use crop measurements when flexible in both directions. 21 if ( control.params.flex_width && control.params.flex_height ) { 22 cropDetails.dst_width = cropDetails.width; 23 cropDetails.dst_height = cropDetails.height; 24 25 // Constrain flexible side based on image ratio and size of the fixed side. 26 } else { 27 cropDetails.dst_width = control.params.flex_width ? control.params.height * ratio : control.params.width; 28 cropDetails.dst_height = control.params.flex_height ? control.params.width / ratio : control.params.height; 24 29 } 25 30 26 31 return wp.ajax.post( 'crop-image', { -
src/wp-includes/js/media-views.js
400 400 CustomizeImageCropper = Controller.Cropper.extend({ 401 401 doCrop: function( attachment ) { 402 402 var cropDetails = attachment.get( 'cropDetails' ), 403 control = this.get( 'control' ); 403 control = this.get( 'control' ), 404 ratio = cropDetails.width / cropDetails.height; 404 405 405 if ( ! control.params.flex_width ) { 406 cropDetails.dst_width = control.params.width; 407 } 408 if ( ! control.params.flex_height ) { 409 cropDetails.dst_height = control.params.height; 406 // Use crop measurements when flexible in both directions. 407 if ( control.params.flex_width && control.params.flex_height ) { 408 cropDetails.dst_width = cropDetails.width; 409 cropDetails.dst_height = cropDetails.height; 410 411 // Constrain flexible side based on image ratio and size of the fixed side. 412 } else { 413 cropDetails.dst_width = control.params.flex_width ? control.params.height * ratio : control.params.width; 414 cropDetails.dst_height = control.params.flex_height ? control.params.width / ratio : control.params.height; 410 415 } 411 416 412 417 return wp.ajax.post( 'crop-image', {