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

Sliders not getting wrapped correctly #2786

Open
placuszek15 opened this issue Mar 5, 2023 · 0 comments
Open

Sliders not getting wrapped correctly #2786

placuszek15 opened this issue Mar 5, 2023 · 0 comments
Labels
bug Something is broken

Comments

@placuszek15
Copy link

Describe the bug
Using ui.horizontal_wrapped() to ui.add() sliders does not seem to wrap them correctly.

To Reproduce
Example code from eframe default app

impl eframe::App for TemplateApp {
    /// Called by the frame work to save state before shutdown.
    fn save(&mut self, storage: &mut dyn eframe::Storage) {
        eframe::set_value(storage, eframe::APP_KEY, self);
    }

    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        let Self { label, value } = self;
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.horizontal_wrapped(|ui| {
                for num in 0..100 {
                let resp = ui.add(egui::Slider::new(&mut self.value, 0.0..=9999.0).text(format!("label nr: {:?}",num )));
            }

            });
            // The central panel the region left after adding TopPanel's and SidePanel's
            egui::warn_if_debug_build(ui);
        });
        }
    }

Expected behavior
If add is changed to add_sized with nearly any size it wraps correctly.

Screenshots

Regular add:
image

add_sized with rough approximates of add's response's rect.max- rect.min:
image

Desktop (please complete the following information):

  • OS: Fedora 6.1.14-100.fc36.x86_64 w/ KDE Plasma

Additional context
I somehow managed to do https://media.discordapp.net/attachments/904461220592119849/1081683278706262116/image.png while trying to massage add_sized with ui.set_max_size(egui::Vec2{x:800.0, y:600.0}) but im unable to reproduce it :/, might be related to incorrect sizes

@placuszek15 placuszek15 added the bug Something is broken label Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant