Skip to content

Commit

Permalink
Site logo: Fix range control on landscape logos (#37733)
Browse files Browse the repository at this point in the history
* Site logo: Fix range control on landscape logos

Make sure the minimum width is an integer when calculating the minimum logo size. This fixes a bug where the range controller returned numbers that wasn't an integer on landscape logos.

* Make sure minHeight is a integer
  • Loading branch information
Petter Walbø Johnsgård authored and noisysocks committed Jan 10, 2022
1 parent 1bd5e5c commit b7d0acf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ const SiteLogo = ( {
const currentWidth = width || defaultWidth;
const ratio = naturalWidth / naturalHeight;
const currentHeight = currentWidth / ratio;
const minWidth = naturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;
const minWidth =
naturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );
const minHeight =
naturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;
naturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );

// With the current implementation of ResizableBox, an image needs an
// explicit pixel value for the max-width. In absence of being able to
Expand Down

0 comments on commit b7d0acf

Please sign in to comment.