Make WordPress Core

Ticket #36441: 36441.0.diff

File 36441.0.diff, 1.3 KB (added by westonruter, 7 years ago)
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 5987bf4ed7..6985b5c130 100644
     
    28292829                /**
    28302830                 * Return whether the image must be cropped, based on required dimensions.
    28312831                 *
    2832                  * @param {bool} flexW
    2833                  * @param {bool} flexH
    2834                  * @param {int}  dstW
    2835                  * @param {int}  dstH
    2836                  * @param {int}  imgW
    2837                  * @param {int}  imgH
    2838                  * @return {bool}
     2832                 * @param {boolean} flexW Width is flexible.
     2833                 * @param {boolean} flexH Height is flexible.
     2834                 * @param {number}  dstW  Required width.
     2835                 * @param {number}  dstH  Required height.
     2836                 * @param {number}  imgW  Provided image's width.
     2837                 * @param {number}  imgH  Provided image's height.
     2838                 * @return {boolean} Whether cropping is required.
    28392839                 */
    28402840                mustBeCropped: function( flexW, flexH, dstW, dstH, imgW, imgH ) {
    28412841                        if ( true === flexW && true === flexH ) {
     
    28582858                                return false;
    28592859                        }
    28602860
     2861                        if ( imgH <= dstH ) {
     2862                                return false;
     2863                        }
     2864
     2865                        // Skip cropping of the image's aspect ratio is the same as the required aspect ratio.
     2866                        if ( Math.abs( ( dstW / dstH ) - ( imgW / imgH ) ) < 0.00001 /* Number.EPSILON */ ) {
     2867                                return false;
     2868                        }
     2869
    28612870                        return true;
    28622871                },
    28632872