Changeset 37113
- Timestamp:
- 03/30/2016 03:13:34 PM (9 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r37042 r37113 401 401 doCrop: function( attachment ) { 402 402 var cropDetails = attachment.get( 'cropDetails' ), 403 control = this.get( 'control' ); 404 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; 403 control = this.get( 'control' ), 404 ratio = cropDetails.width / cropDetails.height; 405 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 -
trunk/src/wp-includes/js/media/controllers/customize-image-cropper.js
r37042 r37113 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
Note: See TracChangeset
for help on using the changeset viewer.