-
Notifications
You must be signed in to change notification settings - Fork 370
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
Better integration of ListItem
in tooltips and other popups
#6486
Changes from 11 commits
3a79ef1
59069e2
805811f
fcf101c
84553b7
e50e9e7
b1aaa72
231ed7a
53be854
3213d0b
eb6a13c
65b181f
16d78c6
972751d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,8 +417,7 @@ pub fn component_path_button_to( | |
} else { | ||
"Temporal component" | ||
}) | ||
.with_icon(icon) | ||
.exact_width(true), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, the contents magically knows not to truncate when in a tooltip |
||
.with_icon(icon), | ||
); | ||
|
||
let component_name = component_path.component_name; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -626,7 +626,7 @@ impl TimePanel { | |
ctx, | ||
&InstancePath::from(tree.path.clone()), | ||
)) | ||
.exact_width(true), | ||
.truncate(false), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't yet magically detect that we are in the time panel, so we still need to tell the contents not to truncate here |
||
|ui| { | ||
self.show_children( | ||
ctx, | ||
|
@@ -772,7 +772,7 @@ impl TimePanel { | |
} else { | ||
&re_ui::icons::COMPONENT_TEMPORAL | ||
}) | ||
.exact_width(true), | ||
.truncate(false), | ||
); | ||
|
||
context_menu_ui_for_item( | ||
|
@@ -816,7 +816,7 @@ impl TimePanel { | |
) | ||
}, | ||
)) | ||
.exact_width(true) | ||
.truncate(false) | ||
.with_icon(if is_static { | ||
&re_ui::icons::COMPONENT_STATIC | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,29 @@ pub fn apply_style_and_install_loaders(egui_ctx: &egui::Context) { | |
|
||
design_tokens().apply(egui_ctx); | ||
} | ||
|
||
/// Used as a heuristic to figure out if it is safe to truncate text. | ||
/// | ||
/// If this returns false, we should never truncate. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Double-negative. Would be easier to follow as "If this returns true, we should truncate text when necessary." The rationale coupling this description to the name of the function still isn't totally obvious. Even if a panel is not resizable, if the text is much longer than the available (non-resizable) panel size, it seems like truncation could be necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I expanded the docstring to clarify |
||
fn is_in_resizable_area(ui: &egui::Ui) -> bool { | ||
re_tracing::profile_function!(); | ||
|
||
let mut is_in_side_panel = false; | ||
|
||
for frame in ui.stack().iter() { | ||
if let Some(kind) = frame.kind() { | ||
if kind.is_area() { | ||
return false; // Our popups (tooltips etc) aren't resizable | ||
} | ||
if matches!(kind, egui::UiKind::LeftPanel | egui::UiKind::RightPanel) { | ||
is_in_side_panel = true; | ||
} | ||
} | ||
} | ||
|
||
if is_in_side_panel { | ||
true // Our side-panels are resizable | ||
} else { | ||
false // Safe fallback | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now detected automagically by
PropertyContent