From b7d0acf8ded2b7d3dc403ef978cf33ec88614f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petter=20Walb=C3=B8=20Johnsg=C3=A5rd?= Date: Thu, 6 Jan 2022 13:47:57 +0100 Subject: [PATCH] Site logo: Fix range control on landscape logos (#37733) * 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 --- packages/block-library/src/site-logo/edit.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js index fa482e65a44199..18f151a48508d9 100644 --- a/packages/block-library/src/site-logo/edit.js +++ b/packages/block-library/src/site-logo/edit.js @@ -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