-
Notifications
You must be signed in to change notification settings - Fork 78
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
SplitLayout: non-proportional splitter position #7410
Comments
Some inspiration: there is a component for the angular framework that offers some advanced options for nesting layouts (https://angular-split.github.io/). Using that split-component you can easily do something like this: Note: the middle (yellow) area has a minimum width, moving the left section will respect this one... |
A prototype that implements the feature can be found on this branch: https://github.com/vaadin/web-components/tree/proto/split-layout/split-position-anchor. The main difference is to set the split-layout-anchor.mp4Some findings:
|
Hi @JayKayDeon, a somewhat similar-looking layout can be produced with two split layouts using the following setup. Not sure if this fully covers your use case: <vaadin-split-layout style="width: 900px; height: 400px; outline: 1px solid black">
<div>Left</div>
<vaadin-split-layout style="height: 100%">
<div style="min-width: 300px; background: lightyellow">Middle</div>
<div style="max-width: 300px">Right</div>
</vaadin-split-layout>
</vaadin-split-layout> Kapture.2024-05-21.at.11.57.04.mp4Update by @DiegoCardoso The same example, but with Flow: SplitLayout outerLayout = new SplitLayout();
SplitLayout innerLayout = new SplitLayout();
outerLayout.addToPrimary(new Span("left"));
outerLayout.addToSecondary(innerLayout);
innerLayout.addToPrimary(new Span("middle"));
innerLayout.addToSecondary(new Span("right"));
outerLayout.getStyle().setOutline("1px solid black");
outerLayout.setHeight("400px");
outerLayout.setWidth("900px");
innerLayout.setPrimaryStyle("background", "lightyellow");
// This is the important part
innerLayout.setPrimaryStyle("min-width", "300px");
innerLayout.setSecondaryStyle("max-width", "300px");
add(outerLayout); |
Describe your motivation
The splitter position is currently always proportional to the width of the SplitLayout, which means that, as the SplitLayout shrinks and grows along the split's axis, both sides of the split scale proportionately.
This is fine in many cases, but sometimes you would need one side to stay unchanged, so that only the other side of the split scales (until the SplitLayout's total size is smaller than the "fixed" side of course).
Describe the solution you'd like
A way to set the splitter position to be "fixed" in relation to one of the sides, e.g. through an API that lets you define either side as the "split position anchor".
(In order to really make this work properly in the Flow component, it would also need a split position setter overload that takes a non-percentual size as argument, e.g.
setSplitterPosition("300px")
).Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: