Skip to content

Commit

Permalink
Make the space views bigger and less cluttered (#269)
Browse files Browse the repository at this point in the history
* Move view3d settings to Selection View

* Move some tensor settings to the selection panel

* Start the tensor slice in the middle

* Update egui

* Put Space View maximize/back/options/help buttons on top of 2d/3d views

* UI tweaks

* Code cleanup

* Nicer panels

* Tweak egui_dock style and margin

* Update egui

* update egui

* captialize

Co-authored-by: Andreas Reich <[email protected]>

* Better tooltip

Co-authored-by: Andreas Reich <[email protected]>

* cargo fmt

* Update egui

* Add ellipsis to "Load…" menu item

* update cargo.lock

Co-authored-by: Andreas Reich <[email protected]>
  • Loading branch information
emilk and Wumpf authored Nov 8, 2022
1 parent 53ff959 commit 13dcb46
Show file tree
Hide file tree
Showing 14 changed files with 374 additions and 206 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ opt-level = 2
debug = true

[patch.crates-io]
# 2022-11-07 - update puffin
eframe = { git = "https://github.com/emilk/egui", rev = "8c76b8caff32e47e4419338e6e0cdf52353cbf2c" }
egui = { git = "https://github.com/emilk/egui", rev = "8c76b8caff32e47e4419338e6e0cdf52353cbf2c" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "8c76b8caff32e47e4419338e6e0cdf52353cbf2c" }
egui_glow = { git = "https://github.com/emilk/egui", rev = "8c76b8caff32e47e4419338e6e0cdf52353cbf2c" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "8c76b8caff32e47e4419338e6e0cdf52353cbf2c" }
# 2022-11-08 - improve panels
eframe = { git = "https://github.com/emilk/egui", rev = "51ff32797da027125e9ce2b9903251b61d1bb11b" }
egui = { git = "https://github.com/emilk/egui", rev = "51ff32797da027125e9ce2b9903251b61d1bb11b" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "51ff32797da027125e9ce2b9903251b61d1bb11b" }
egui_glow = { git = "https://github.com/emilk/egui", rev = "51ff32797da027125e9ce2b9903251b61d1bb11b" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "51ff32797da027125e9ce2b9903251b61d1bb11b" }

# eframe = { path = "../../egui/crates/eframe" }
# egui = { path = "../../egui/crates/egui" }
Expand Down
6 changes: 2 additions & 4 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl AppState {

let central_panel_frame = egui::Frame {
fill: egui_ctx.style().visuals.window_fill(),
inner_margin: egui::style::Margin::symmetric(4.0, 0.0),
inner_margin: egui::style::Margin::same(0.0),
..Default::default()
};

Expand Down Expand Up @@ -551,11 +551,9 @@ fn top_panel(egui_ctx: &egui::Context, frame: &mut eframe::Frame, app: &mut App)
crate::profile_function!();

let panel_frame = {
let style = egui_ctx.style();
egui::Frame {
inner_margin: egui::style::Margin::symmetric(8.0, 2.0),
fill: app.design_tokens.top_bar_color,
stroke: style.visuals.window_stroke(),
..Default::default()
}
};
Expand Down Expand Up @@ -776,7 +774,7 @@ fn file_menu(ui: &mut egui::Ui, app: &mut App, frame: &mut eframe::Frame) {

#[cfg(not(target_arch = "wasm32"))]
if ui
.button("Load")
.button("Load")
.on_hover_text("Load a Rerun Data File (.rrd)")
.clicked()
{
Expand Down
13 changes: 12 additions & 1 deletion crates/re_viewer/src/design_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ impl DesignTokens {
egui::Frame {
fill: egui_ctx.style().visuals.window_fill(),
inner_margin: egui::style::Margin::same(4.0),
stroke: egui_ctx.style().visuals.window_stroke(),
..Default::default()
}
}

#[allow(clippy::unused_self)]
pub fn hovering_frame(&self, style: &egui::Style) -> egui::Frame {
egui::Frame {
inner_margin: egui::style::Margin::same(2.0),
outer_margin: egui::style::Margin::same(4.0),
rounding: 4.0.into(),
fill: style.visuals.window_fill(),
stroke: style.visuals.window_stroke(),
..Default::default()
}
}
Expand Down
16 changes: 16 additions & 0 deletions crates/re_viewer/src/misc/viewer_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use macaw::Ray3;
use re_data_store::{log_db::LogDb, InstanceId, ObjTypePath};
use re_log_types::{DataPath, MsgId, ObjPath, TimeInt, Timeline};

use crate::ui::SpaceViewId;

/// Common things needed by many parts of the viewer.
pub(crate) struct ViewerContext<'a> {
/// Global options for the whole viewer.
Expand Down Expand Up @@ -118,6 +120,20 @@ impl<'a> ViewerContext<'a> {
response
}

pub fn space_view_button_to(
&mut self,
ui: &mut egui::Ui,
text: impl Into<egui::WidgetText>,
space_view_id: SpaceViewId,
) -> egui::Response {
let is_selected = self.rec_cfg.selection == Selection::SpaceView(space_view_id);
let response = ui.selectable_label(is_selected, text);
if response.clicked() {
self.rec_cfg.selection = Selection::SpaceView(space_view_id);
}
response
}

pub fn time_button(
&mut self,
ui: &mut egui::Ui,
Expand Down
16 changes: 15 additions & 1 deletion crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,19 @@ fn ui_space_view(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, space_view: &mu
ui.end_row();
});

// TODO(emilk): view settings
ui.separator();

match space_view.selected_category {
super::space_view::ViewCategory::ThreeD => {
ui.label("3D view.");
super::view_3d::show_settings_ui(ctx, ui, &mut space_view.view_state.state_3d);
}
super::space_view::ViewCategory::Tensor => {
if let Some(state_tensor) = &mut space_view.view_state.state_tensor {
ui.label("Tensor view.");
state_tensor.ui(ui);
}
}
super::space_view::ViewCategory::TwoD | super::space_view::ViewCategory::Text => {}
}
}
Loading

0 comments on commit 13dcb46

Please sign in to comment.