-
Notifications
You must be signed in to change notification settings - Fork 373
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
Improve UI of various components in the selection panel #6297
Changes from 5 commits
e484b67
4439c48
1789453
673bd78
5f871e3
15d9c28
8cbbdd1
3857fb9
dd79e58
8622eff
0569595
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 |
---|---|---|
|
@@ -12,18 +12,17 @@ use re_viewer_context::{ | |
ViewerContext, | ||
}; | ||
|
||
use crate::image_meaning_for_entity; | ||
use crate::{image_meaning_for_entity, label_for_ui_layout}; | ||
|
||
use super::EntityDataUi; | ||
|
||
pub fn format_tensor_shape_single_line(shape: &[TensorDimension]) -> String { | ||
const MAX_SHOWN: usize = 4; // should be enough for width/height/depth and then some! | ||
let shapes = shape.iter().take(MAX_SHOWN).join(", "); | ||
if shape.len() > MAX_SHOWN { | ||
format!("{shapes}…") | ||
} else { | ||
shapes | ||
} | ||
format!( | ||
"shape: {shapes}{}", | ||
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. the 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. yep, one screenshot slept through outdated :) That said: I dont think I guess I could go 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 figured out a decent way, see updated screenshots. I also added some cases to the checklist. |
||
if shape.len() > MAX_SHOWN { ",…" } else { "" } | ||
) | ||
} | ||
|
||
impl EntityDataUi for re_types::components::TensorData { | ||
|
@@ -64,7 +63,7 @@ impl EntityDataUi for re_types::components::TensorData { | |
); | ||
} | ||
Err(err) => { | ||
ui.label(ctx.re_ui.error_text(err.to_string())); | ||
label_for_ui_layout(ui, ui_layout, ctx.re_ui.error_text(err.to_string())); | ||
} | ||
} | ||
} | ||
|
@@ -157,7 +156,7 @@ pub fn tensor_ui( | |
], | ||
None => tensor.shape.clone(), | ||
}; | ||
ui.add(egui::Label::new(format_tensor_shape_single_line(&shape)).wrap(true)) | ||
label_for_ui_layout(ui, ui_layout, format_tensor_shape_single_line(&shape)) | ||
.on_hover_ui(|ui| { | ||
tensor_summary_ui( | ||
ctx.re_ui, | ||
|
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.
so before we had data ui implement for those we'd just generate a label automatically. Shouldn't that label generation use
label_for_ui_layout
instead?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.
Are you referring to
text_ui()
(incomponent_ui_registry.rs
)? I believe several code path lead to that function.Looking at it a bit more... It's essentially doing a more fancy version of
label_for_ui_layout
, so these are possibly duplicates.text_ui
uses monospace font though, I'm not sure why. Seems like some further cleaning is in order around here.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.
See update PR description. There is much work to be done here still.