Skip to content

Commit

Permalink
Post Featured Image: Don't display the scale control when the aspect …
Browse files Browse the repository at this point in the history
…ratio is original (#48894)

* Post Featured Image: Don't display the scale control when the aspect ratio is original

* Store the conditional statement in variable
  • Loading branch information
t-hamano authored Mar 31, 2023
1 parent a1f2679 commit c1ca585
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ const DimensionControls = ( {
} );
};
const scaleLabel = _x( 'Scale', 'Image scaling options' );

const showScaleControl =
height || ( aspectRatio && aspectRatio !== 'auto' );

return (
<InspectorControls group="dimensions">
<ToolsPanelItem
Expand Down Expand Up @@ -170,7 +174,7 @@ const DimensionControls = ( {
units={ units }
/>
</ToolsPanelItem>
{ ( height || aspectRatio ) && (
{ showScaleControl && (
<ToolsPanelItem
hasValue={ () => !! scale && scale !== DEFAULT_SCALE }
label={ scaleLabel }
Expand Down

0 comments on commit c1ca585

Please sign in to comment.