Skip to content

Conversation

@SmitSonani
Copy link

In attributes Map, when width & height both are "0", the _aspectRatio function was returning NaN instead some valid ratio.

if (heightString != null && widthString != null) {
final height = double.tryParse(heightString);
final width = double.tryParse(widthString);
return height == null || width == null ? calculated.data!.aspectRatio : width / height;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you solution is okay but would it have been enough to just check that height is not 0 and return 1 in that case?

@Sub6Resources
Copy link
Owner

#1222 provides a more clean solution. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants