bevy-inspector-egui icon indicating copy to clipboard operation
bevy-inspector-egui copied to clipboard

min text area width?

Open gilescope opened this issue 3 years ago • 6 comments

Is there a way we can force it to not have such narrow text areas? At the moment it seems to wrap at a line length of 7 chars or so.

egui_ctx.ctx_mut().set_style(egui::Style {
        wrap:Some(false),
        spacing: Spacing {
            text_edit_width: 1000.,
            ..default()
        },
        ..default()
    });

I tried the above but it seemed to make no effect. Other things are wider so it could use up more space if it wanted to but it chooses not to. Being able to set min / max text width as an attribute would be good.

gilescope avatar May 09 '22 06:05 gilescope

Screenshot from 2022-05-09 07-15-22

Sometimes a picture is worth 1000 words...

gilescope avatar May 09 '22 06:05 gilescope

I think here https://github.com/jakobhellermann/bevy-inspector-egui/blob/3190cbc78eb8887ef8ea040cadcb288513b6a994/src/impls/std.rs#L17

we need to set be able to set https://github.com/emilk/egui/blob/87ca29173d2d5dd5421b80b274fa59504757918f/egui/src/widgets/text_edit/builder.rs#L66

gilescope avatar May 09 '22 06:05 gilescope

It may be necessary but it's not sufficient. I think something in the parent component needs to change too.

gilescope avatar May 10 '22 19:05 gilescope

Not using derive inspectable but implementing it myself on the parent was key:

        ui.vertical_centered(|ui| {
            Grid::new(context.id())
            .min_col_width(500.)
            .show(ui, |ui| {

Happy.

gilescope avatar May 10 '22 21:05 gilescope

I believe this is caused by not setting num_columns on the Grid - https://docs.rs/egui/latest/src/egui/grid.rs.html#305-308 - so layout has no idea whether it needs to leave space for more columns.

Setting num_columns to 2 and then wrapping the field value inspector in ui.allocate_ui or whatever should make everything work much more sensibly.

XMPPwocky avatar Jan 22 '23 18:01 XMPPwocky