Skip to content
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

encourage use of BoxConstraints::constrain in all layout methods #854

Open
cmyr opened this issue Apr 16, 2020 · 4 comments
Open

encourage use of BoxConstraints::constrain in all layout methods #854

cmyr opened this issue Apr 16, 2020 · 4 comments
Labels
discussion needs feedback and ideas

Comments

@cmyr
Copy link
Member

cmyr commented Apr 16, 2020

a general note; I think it's good to call bc.constrain(size) anytime you return from layout, as a way of ensuring all returned sizes are appropriate for the constraints.

Originally posted by @cmyr in #845

@cmyr
Copy link
Member Author

cmyr commented Apr 16, 2020

Another thing that has occurred to me is that we could track when this is and isn't called, and log when it isn't. I'm not sure this makes sense, but it is an option.

@xStrom
Copy link
Member

xStrom commented Apr 16, 2020

Track it in WidgetPod? Might as well just call it in WidgetPod's layout then.

@luleyleo luleyleo added the discussion needs feedback and ideas label Apr 17, 2020
@luleyleo
Copy link
Collaborator

I wonder if there is any valid use case for a widget to violate its constraints?
Considering how mouse / touch input operates in druid it seems like violating constraints would actually break events in a nasty way. Probably enforcing constraints in WidgetPod::layout and logging a warning when the constraints are not met would make sens.

@cmyr
Copy link
Member Author

cmyr commented Apr 17, 2020

yea, I think violating constraints is an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion needs feedback and ideas
Projects
None yet
Development

No branches or pull requests

3 participants