From 9116c6e611f4608af5bb2693bf71fc49c8093a9f Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Wed, 8 Mar 2023 00:45:29 +0900 Subject: [PATCH 1/2] Post Featured Image: Don't display the scale control when the aspect ratio is original --- .../block-library/src/post-featured-image/dimension-controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/post-featured-image/dimension-controls.js b/packages/block-library/src/post-featured-image/dimension-controls.js index 729d1c331a2c6d..c3bccdf35b608b 100644 --- a/packages/block-library/src/post-featured-image/dimension-controls.js +++ b/packages/block-library/src/post-featured-image/dimension-controls.js @@ -170,7 +170,7 @@ const DimensionControls = ( { units={ units } /> - { ( height || aspectRatio ) && ( + { ( height || ( aspectRatio && aspectRatio !== 'auto' ) ) && ( !! scale && scale !== DEFAULT_SCALE } label={ scaleLabel } From fda34cab1c92c0dee2686c0648a029fe2d891a56 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 31 Mar 2023 18:11:54 +0900 Subject: [PATCH 2/2] Store the conditional statement in variable --- .../src/post-featured-image/dimension-controls.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/post-featured-image/dimension-controls.js b/packages/block-library/src/post-featured-image/dimension-controls.js index c3bccdf35b608b..5e1204922880c6 100644 --- a/packages/block-library/src/post-featured-image/dimension-controls.js +++ b/packages/block-library/src/post-featured-image/dimension-controls.js @@ -70,6 +70,10 @@ const DimensionControls = ( { } ); }; const scaleLabel = _x( 'Scale', 'Image scaling options' ); + + const showScaleControl = + height || ( aspectRatio && aspectRatio !== 'auto' ); + return ( - { ( height || ( aspectRatio && aspectRatio !== 'auto' ) ) && ( + { showScaleControl && ( !! scale && scale !== DEFAULT_SCALE } label={ scaleLabel }