Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6489f02

Browse files
authored
Don't close columns menu on click (#11119)
### What Don't close the columns menu when clicking inside the popup, which was really annoying when trying to hide / show / reorder multiple columns. Also fixes the drag handle not being visible in light mode. https://github.com/user-attachments/assets/ff167906-6b3b-478a-b799-38837841b617
1 parent f4e1e5f commit 6489f02

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

crates/viewer/re_dataframe_ui/src/table_utils.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use ahash::HashSet;
2-
use egui::{Color32, Context, Frame, Id, RichText, Stroke, Style};
2+
use egui::containers::menu::{MenuButton, MenuConfig};
3+
use egui::{Button, Color32, Context, Frame, Id, PopupCloseBehavior, RichText, Stroke, Style};
4+
35
use re_ui::{UiExt as _, design_tokens_of, icons};
46

57
/// This applies some fixes so that the column resize bar is correctly displayed.
@@ -201,7 +203,7 @@ impl TableConfig {
201203
ui,
202204
|ui| {
203205
handle.ui(ui, |ui| {
204-
ui.small_icon(&icons::DND_HANDLE, None);
206+
ui.small_icon(&icons::DND_HANDLE, Some(ui.visuals().text_color()));
205207
});
206208
let mut label = RichText::new(&column.name);
207209
if visible {
@@ -230,7 +232,12 @@ impl TableConfig {
230232
}
231233

232234
pub fn button_ui(&mut self, ui: &mut egui::Ui) {
233-
ui.menu_image_text_button(icons::SETTINGS.as_image(), "Columns", |ui| {
235+
MenuButton::from_button(Button::image_and_text(
236+
icons::SETTINGS.as_image(),
237+
"Columns",
238+
))
239+
.config(MenuConfig::new().close_behavior(PopupCloseBehavior::CloseOnClickOutside))
240+
.ui(ui, |ui| {
234241
self.ui(ui);
235242
});
236243
}

0 commit comments

Comments
 (0)