From 47768b19e9d7452fdcf3c42693bc13339db1559c Mon Sep 17 00:00:00 2001 From: mvlabat Date: Sun, 7 Jul 2024 10:17:30 +0300 Subject: [PATCH] Attempt to reproduce #292 --- examples/side_panel.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/side_panel.rs b/examples/side_panel.rs index 5989f27fc..e129d51b7 100644 --- a/examples/side_panel.rs +++ b/examples/side_panel.rs @@ -1,4 +1,5 @@ use bevy::{prelude::*, window::PrimaryWindow}; +use bevy::winit::WinitSettings; use bevy_egui::{EguiContexts, EguiPlugin}; #[derive(Default, Resource)] @@ -16,6 +17,7 @@ struct OriginalCameraTransform(Transform); fn main() { App::new() + .insert_resource(WinitSettings::desktop_app()) .add_plugins(DefaultPlugins) .add_plugins(EguiPlugin) .init_resource::() @@ -26,6 +28,7 @@ fn main() { } fn ui_example_system( + mut is_last_selected: Local, mut contexts: EguiContexts, mut occupied_screen_space: ResMut, ) { @@ -35,6 +38,12 @@ fn ui_example_system( .resizable(true) .show(ctx, |ui| { ui.label("Left resizeable panel"); + if ui.add(egui::widgets::Button::new("A button").selected(!*is_last_selected)).clicked() { + *is_last_selected = false; + } + if ui.add(egui::widgets::Button::new("Another button").selected(*is_last_selected)).clicked() { + *is_last_selected = true; + } ui.allocate_rect(ui.available_rect_before_wrap(), egui::Sense::hover()); }) .response