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

Set preferred size for a pane #228

Closed
2 tasks
johnwalley opened this issue Apr 8, 2022 · 5 comments · Fixed by #229
Closed
2 tasks

Set preferred size for a pane #228

johnwalley opened this issue Apr 8, 2022 · 5 comments · Fixed by #229
Assignees
Labels
enhancement New feature or request

Comments

@johnwalley
Copy link
Owner

johnwalley commented Apr 8, 2022

Purpose

As a developer I would like to set a preferred size for when the user double clicks a sash adjacent to a pane.

Proposal

Let's play with the idea of using defaultSizes purely for setting the sizes on initial mount. The main use case here is for applications to persist the layout.

We can then introduce a concept of preferred size purely for use when resetting the panes' layout.

A good starting point would be to look at the VS Code Grid component.

Screenshot 2022-04-08 at 12 01 46

Acceptance criteria

  • As a developer I can set a preferred size for a pane
  • As a developer when I double clock a sash adjacent to a pane with a preferred size that pane should be set to that size (unless minimum or maximum size conflict)
@johnwalley johnwalley self-assigned this Apr 8, 2022
@johnwalley johnwalley added the enhancement New feature or request label Apr 8, 2022
@johnwalley
Copy link
Owner Author

A proof of concept. The sidebar has a preferred size of 300px.

Apr-08-2022 12-38-25

@johnwalley
Copy link
Owner Author

We might need to introduce the internal concept of high/low priority views. What's currently happening is that the views are given the correct sizes. However, when we relayout, we distribute space from right to left. So if the last view has been shrunk, it will immediately be expanded to fill in the missing space!

@johnwalley
Copy link
Owner Author

It would be helpful to allow the preferred size to be dynamic, e.g.

Screenshot 2022-04-08 at 17 53 26

@johnwalley
Copy link
Owner Author

Percentage based size would also be nice.

@johnwalley
Copy link
Owner Author

johnwalley commented Apr 9, 2022

Make sure to consider the behaviour when adding a new frame. Should it take on its preferred size?

Also, what happens when we reset the whole split view? How should space be allotted amongst multiple panes with preferred sizes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant