Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add rounding to the size given to BoxConstraints::constrain. #734

Merged
merged 1 commit into from
Mar 22, 2020

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented Mar 22, 2020

This PR is a continuation of the pixel grid work started in #669. Adding Size::expand to BoxConstraints::constrain seems to go a long way in solving this. It solves the issue for Label but also in more subtle places like Switch which depend on theme variables by doing things like this:

let width = env.get(theme::BORDERED_WIDGET_HEIGHT) * SWITCH_WIDTH_RATIO; // 24 * 2.75

Doing it in BoxConstraints::constrain will also help with custom widgets that users might unknowingly make fractional.

I reviewed all current widgets in druid and this change doesn't seem to have any other effects at this point.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

Excellent, thanks.

@xStrom xStrom merged commit 3eafd81 into linebender:master Mar 22, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants