Skip to content

Commit 78d974f

Browse files
authored
Fix some component UI (#7174)
### What This PR fixes the UI for enum components and `Colormap`, which was broken by #7171 <img width="486" alt="image" src="https://github.com/user-attachments/assets/e86b22e7-01a7-40f5-b744-940e52b443e4"> <br/><br/> Note/PSA: we still have a bunch of components that are not truncating correctly, but most have quite narrow UI, so we can live with it for bit. <img width="291" alt="image" src="https://github.com/user-attachments/assets/00c38da5-e7f6-42b3-94c0-f6ebc8af4551"> ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7174?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7174?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7174) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
1 parent 8d2e79c commit 78d974f

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

crates/viewer/re_edit_ui/src/datatype_editors/enum_combobox.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn edit_view_enum_impl<EnumT: re_types_core::reflection::Enum>(
4848

4949
response_with_changes_of_inner(combobox_response)
5050
} else {
51-
ui.label(current_value.to_string())
51+
ui.add(egui::Label::new(current_value.to_string()).truncate())
5252
}
5353
}
5454

crates/viewer/re_viewer_context/src/gpu_bridge/colormap.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use re_types::reflection::Enum as _;
2-
use re_ui::{list_item, UiExt};
2+
use re_ui::list_item;
33

44
use crate::{
55
gpu_bridge::{get_or_create_texture, render_image},
@@ -136,18 +136,21 @@ pub fn colormap_edit_or_view_ui(
136136
inner_response.response
137137
} else {
138138
let map: re_types::components::Colormap = **map;
139-
if let Some(render_ctx) = ctx.render_ctx {
140-
ui.list_item_flat_noninteractive(
141-
list_item::PropertyContent::new(map.to_string())
142-
.min_desired_width(MIN_WIDTH)
143-
.value_fn(|ui, _| {
144-
if let Err(err) = colormap_preview_ui(render_ctx, ui, map) {
145-
re_log::error_once!("Failed to paint colormap preview: {err}");
146-
}
147-
}),
148-
)
139+
let colormap_response = if let Some(render_ctx) = ctx.render_ctx {
140+
let result = colormap_preview_ui(render_ctx, ui, map);
141+
if let Err(err) = &result {
142+
re_log::error_once!("Failed to paint colormap preview: {err}");
143+
}
144+
result.ok()
149145
} else {
150-
ui.list_item_flat_noninteractive(list_item::LabelContent::new(map.to_string()))
146+
None
147+
};
148+
149+
let label_response = ui.add(egui::Label::new(map.to_string()).truncate());
150+
151+
match colormap_response {
152+
Some(colormap_response) => colormap_response | label_response,
153+
None => label_response,
151154
}
152155
}
153156
}

0 commit comments

Comments
 (0)