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

Allotment.Pane add prop defaultSize #103

Open
NomadBin opened this issue Dec 27, 2021 · 4 comments
Open

Allotment.Pane add prop defaultSize #103

NomadBin opened this issue Dec 27, 2021 · 4 comments

Comments

@NomadBin
Copy link
Contributor

The Allotment.Pane seem to use the maxSize to as a default size. But I want to controll the default pane size. so. I think that is great to add prop defaultSize.

example code:

<Allotment.Pane maxSize={200} minSize={100} defaultSize={100}>
  <div>div1</div>
</Allotment.Pane>
@NomadBin
Copy link
Contributor Author

I tried using the defaultSizes property of Allotment, but it seemed to clash with the minSize and maxSize of the Allotment.Pane

@johnwalley
Copy link
Owner

That makes sense. I'll have a go at implementing something and let you know when it's ready to test.

A particular use case I have in mind is for an editor like VS Code where you'd have two panes side by side. The left one being the directory tree view and the right one being the file editor. You'd want to fix the initial size of the left pane.

The reason it's not completely trivial is that you could imagine implementing a full-on flexbox-like layout algorithm (which is close to what VS Code does). Perhaps a simple starting point would be to attempt to give the panes with a specified size that size and allocate the remaining space evenly between the panes without a specified size. I say 'attempt' because if you ask for sizes which sum to more than the available space then we can't satisfy that requirement. Similarly, minSize would interact with this too.

@NomadBin
Copy link
Contributor Author

A particular use case

Yes, my application scenario is similar to vscode.

Thank you for your hard work, waiting for your progress.

@pahen
Copy link
Contributor

pahen commented Feb 22, 2022

I tried using the defaultSizes property of Allotment, but it seemed to clash with the minSize and maxSize of the Allotment.Pane

I have this issue too. Shouldn't is be possible to use defaultSizes and minSize together @johnwalley ?

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

No branches or pull requests

3 participants