-
Notifications
You must be signed in to change notification settings - Fork 567
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
Implement min size constraint for splitter #613
Conversation
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 agree this API is a bit tricky, and I'm honestly not sure if I can think of anything better.
The best idea I have is still the one I mentioned in the linked issue; just have a single min_size
that is shared between both sides of the split. This might not be perfect, but I do think it probably solves 90% of cases?
Okay. I simplified the API additionally, I changed the splitter demo to only have a single splitter. Since it doesn't make a lot of sense to have a nested splitter in case the min sizes are really off (the min size for the right 2 is together the same as the min size for the left split). I guess a good solution at some point might be to move to a splitter where you can have multiple splits? This is how QT does it as far as I know. |
I think we should index the panes left-to-right and top-to-bottom. So to min-size them independently, we have I had gone for 'simple, fast, and composable' with the single-splitter-only design. It handles, I think, the 80% case and has much simpler code than a multiway split. I also think filling out the constraints (mins and maxes) makes having to split several times more tolerable. I think being able to set the split point in units (pixels?) gets us the rest of the way to workable. However, I wouldn't be opposed to creating a separate multisplitter, or altering this one with a vec of parameters, and so an arbitrary number of splits. Whichever we think is more appropriate. I think in that case agreeing to indexing in a direction would matter. |
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.
A couple little notes, but looks good!
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 good, thanks. I have one doc fix I'll apply before merging, trust you don't mind.
I am not sure about the API still for the split constraints. But this is a draft of how to implement them. You can check it out in the "split_demo" example.
Closes issue #540