8000 Horizontal and vertical splitter · Issue #944 · emilk/egui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Horizontal and vertical splitter #944

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

Open
feelingnothing opened this issue Dec 10, 2021 · 6 comments · May be fixed by #1028
Open

Horizontal and vertical splitter #944

feelingnothing opened this issue Dec 10, 2021 · 6 comments · May be fixed by #1028
Labels
feature New feature or request

Comments

@feelingnothing
Copy link

Splits frame in half with access to each frame by two lambdas for each half

Is your feature request related to a problem? Please describe.

Not being able to place elements in one line with different directions

Describe the solution you'd like

Horizontal and vertical splitter that splits frame in half

Describe alternatives you've considered

Additional context

Couldn't think of a way to split by n times with access to different frames at once, there is a way to make a different function for each n way split, but it would be messy for sure

@emilk emilk added the feature New feature or request label Dec 28, 2021
@emilk emilk changed the title [Musthave] Horizontal and vertical splitter Horizontal and vertical splitter Dec 28, 2021
@emilk
Copy link
Owner
emilk commented Dec 28, 2021

This should be relatively easy to implement if anyone wants to take a stab at it. An interface like this should work pretty well:

egui::VerticalSplitter::new().show(ui, |left_ui, right_ui| {});

@LordMZTE
Copy link
Contributor

Wouldn't it be nicer to have the same struct do both vertical and horizontal splitting, so egui::Splitter::horizontal() or egui::Splitter::vertical()? Once we get the API down, I'd definetely like to have a go at implementing it 😄

@LordMZTE LordMZTE linked a pull request Jan 1, 2022 that will close this issue
@emilk
Copy link
Owner
emilk commented Apr 16, 2022

Just a note: I think the split position should be stored in fraction (e.g. 40%) so when resizing the outer container, the splitter stays at the same relative position.

@Timmmm
Copy link
Timmmm commented Jan 7, 2023

This would be nice. A few things to consider:

  • Sometimes you don't want them to scale proportionally (e.g. think about resizing a Blender window) so it should be configurable.
  • If you want three panes and your UI library only supports two pane splitters, you have to nest them. But this often leads to weird behaviour. It would be good if it supported an arbitrary number of panes.
  • If you want four panes (two up two down) then again you might be forced to have a horizontal splitter with a vertical splitter in each of its panes. But this doesn't give you a four-way splitter because a) the two vertical splitters can get out of sync, and b) normally you can click and drag the middle point where the splitters cross and it will move both splitters at once.

@mkalte666
Copy link
Contributor

I see the issues with this (i dearly hope i wont need multiple splits x.x), but if anyone just needs a quick and dirty two pane splitter, until this ends up in egui in a proper and nicely done way, you can use this in your project

https://gist.github.com/mkalte666/f9a982be0ac0276080d3434ab9ea4655

Giving this out as public domain, CC0, no warranty, etc etc.
Just hoping this will be useful to someone.

@emilk emilk removed this from the 0.24.0 milestone Nov 21, 2023
@ilyas-taouaou
Copy link

what's the status of this?

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

Successfully merging a pull request may close this issue.

6 participants
0