-
Notifications
You must be signed in to change notification settings - Fork 250
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
Conversation
UiLayout::List
of many DataUi
implementationDataUi
implementation compliant with the constraints of UiLayout::List
DataUi
implementation compliant with the constraints of UiLayout::List
DataUi
implementations compliant with the constraints of UiLayout::List
2a9e780
to
5f871e3
Compare
DataUi
implementations compliant with the constraints of UiLayout::List
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.
nice!
crates/re_data_ui/src/data.rs
Outdated
impl DataUi for Range1D { | ||
fn data_ui( | ||
&self, | ||
_ctx: &ViewerContext<'_>, | ||
ui: &mut Ui, | ||
ui_layout: UiLayout, | ||
_query: &LatestAtQuery, | ||
_db: &EntityDb, | ||
) { | ||
label_for_ui_layout(ui, ui_layout, self.to_string()); | ||
} | ||
} | ||
|
||
impl DataUi for Range2D { | ||
fn data_ui( | ||
&self, | ||
_ctx: &ViewerContext<'_>, | ||
ui: &mut Ui, | ||
ui_layout: UiLayout, | ||
_query: &LatestAtQuery, | ||
_db: &EntityDb, | ||
) { | ||
label_for_ui_layout(ui, ui_layout, self.to_string()); | ||
} | ||
} |
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()
(in component_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.
crates/re_data_ui/src/image.rs
Outdated
shapes | ||
} | ||
format!( | ||
"shape: {shapes}{}", |
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.
the shape:
part isn't useful and just takes space imho. Interestingly, on the screenshots you took one has it and one doesn't ;-)
(I checked locally, it's always there now)
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.
yep, one screenshot slept through outdated :)
That said: I dont think 4, 3, 5, 1
by itself is very descriptive. that looks very much like a 1x4 int tensor (which it is not).
I guess I could go 4x3x5x1
, but still need to special case when dimension have labels. Will give it a second look.
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.
I figured out a decent way, see updated screenshots. I also added some cases to the checklist.
…aces instead of `label_for_ui_layout`
What
UiVerbosity
toUiLayout
and make its variants more precise #6291UiVerbosity
toUiLayout
and tighten up related implementations #6245ListItem
style for the component list (in the Selection Panel when an entity is selected) #4161This PR fixes the
UiLayout::List
implementations ofDataUi
such that they all fit on a single line and are deal with potentially narrow space (mostly via truncation).This PR unearthed quite some inconsistencies in how we're using monospace font for data. For now,
text_ui
(which uses monospace) has been renameddata_label_for_ui_layout
to parallel the newlabel_for_ui_layout
(which uses proportional). In the future (#6315), we must unify both with a better, flexible API that also allows mixed styles.TODO:
size(shape) > 3
Screenshots
When truncated:
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.