-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimensions Tool: Change the conditions underwhich we display the scale control #53334
Conversation
Size Change: +104 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
aspectRatio: `${ ratio }`, | ||
aspectRatio: | ||
ratio === naturalRatio | ||
? undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this explicitly need to be 'auto'
? In most cases undefined
/unset is treated as auto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference is how it interacts with external CSS. Setting 'auto'
will output the inline CSS, overriding the external value; whereas, undefined
will output nothing, so it doesn't get overridden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you changed it already :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scruffian I guess my question is, do you think this should be overridable by external CSS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's best to leave it unset
What?
Don't show the scale control when aspect ratio is set to "Original".
Why?
This PR changed the way we save the aspect ratio control which means that we save the aspect ratio even when it's set to the natural/original ratio. We shouldn't display the scale control when the aspect ratio is set to original, as it doesn't do anything.
How?
Save the aspect ratio as
auto
when the selected ratio is the same as the natural ratio.Testing Instructions
Screenshots or screencast
Note
I also discovered a bug whereby resizing image that had an aspect ratio set caused the block to crash. This is because the block was saving the aspect ratio as a number instead of a string. I have reverted the aspect ratio we save back to a string.