rerun-io / egui_tiles

A tiling layout engine for egui with drag-and-drop and resizing
Apache License 2.0
310 stars 25 forks source link

on_tab_button in behavior is mostly useless. #22

Closed mkrueger closed 12 months ago

mkrueger commented 1 year ago

The biggest use case for that in many applications would be adding a context menu.

But this doesn't work:

fn on_tab_button(
        &mut self,
        tiles: &Tiles<Tab>,
        tile_id: TileId,
        button_response: &Response,
    ) {
        button_response.context_menu(|ui| {
            if ui
            .button("close")
            .clicked()
            {
                ui.close_menu();
            }
           // etc.
        });
    }

Changing that to would fix the problem.

fn on_tab_button(
        &mut self,
        tiles: &Tiles<Tab>,
        tile_id: TileId,
        button_response: Response,
    )  -> Response

   {
        button_response.context_menu(|ui| {
            if ui
            .button("close")
            .clicked()
            {
                ui.close_menu();
            }
           // etc.
        })
    }

One proposed change would be: https://github.com/rerun-io/egui_tiles/pull/23

EDIT: Thanks for making this library. I'm currently developing some sort of drawing/editing tool. This lib will make it shine :).