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

Dynamically adding tiles/panes if only one pane exists #83

Open
canselcik opened this issue Sep 6, 2024 · 1 comment
Open

Dynamically adding tiles/panes if only one pane exists #83

canselcik opened this issue Sep 6, 2024 · 1 comment

Comments

@canselcik
Copy link

I am probably doing it wrong but there seems to be some sort of idiosyncrasy to it that I am having a hard time figuring out.

If I created the tree as such:

    let mut tiles = egui_tiles::Tiles::default();
    let children = vec![
        tiles.insert_pane(Pane {
            nr: PaneType::Chart("SOMETHING", "SOMETHING".to_string()),
            retained: true,
        }),
        tiles.insert_pane(Pane {
            nr: PaneType::EmptyDemo(Color32::DARK_BLUE),
            retained: true,
        }),
    ];
    let h2 = tiles.insert_tab_tile(children);
    egui_tiles::Tree::new("tree_root", h2, tiles)

And then try to add a new tile like:

        if ui.button("UI Panels Test").clicked() {
            if let Some(r) = self.tree.root() {
                self.log("Found root");
                let content = Pane {
                    nr: PaneType::EmptyDemo(Color32::DARK_BLUE),
                    retained: true,
                };
                let t = vec![self.tree.tiles.insert_pane(content)];
                let pid = self.tree.tiles.insert_horizontal_tile(t);
                self.tree.move_tile_to_container(pid, r.clone(), 0, true);
            }
        }

It works fine. But if I closed the PaneType::EmptyDemo(Color32::DARK_BLUE) pane before creating another, it never shows up.

Is it about the size of the new panel?

@canselcik canselcik changed the title Dynamically adding tiles/panes Dynamically adding tiles/panes if only one pane exists Sep 6, 2024
@canselcik
Copy link
Author

As a workaround I added an empty pane and marked it invisible. Everything works as expected.

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

1 participant