Skip to content
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

Allow hiding all TimePanel/BlueprintPanel/SelectionPanel #6407

Merged
merged 8 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,7 @@ dependencies = [
"re_format",
"re_log_types",
"re_tracing",
"re_types",
"re_ui",
"re_viewer_context",
"re_viewport",
Expand Down
8 changes: 4 additions & 4 deletions crates/re_query/src/latest_at/to_archetype/panel_blueprint.rs

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

1 change: 1 addition & 0 deletions crates/re_time_panel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ re_entity_db.workspace = true
re_format.workspace = true
re_log_types.workspace = true
re_tracing.workspace = true
re_types.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true
re_viewport.workspace = true # TODO(#5421): remove this dependency in favor of re_viewport_blueprint when it exists
Expand Down
7 changes: 4 additions & 3 deletions crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use re_log_types::{
external::re_types_core::ComponentName, ComponentPath, EntityPath, EntityPathPart,
ResolvedTimeRange, TimeInt, TimeReal,
};
use re_types::blueprint::components::PanelState;
use re_ui::list_item;
use re_viewer_context::{
CollapseScope, HoverHighlight, Item, RecordingConfig, TimeControl, TimeView, UiLayout,
Expand Down Expand Up @@ -143,7 +144,7 @@ impl TimePanel {
entity_db: &re_entity_db::EntityDb,
rec_cfg: &RecordingConfig,
ui: &mut egui::Ui,
time_panel_expanded: bool,
state: PanelState,
) {
// Naturally, many parts of the time panel need the time control.
// Copy it once, read/edit, and then write back at the end if there was a change.
Expand All @@ -158,7 +159,7 @@ impl TimePanel {
let margin = ctx.re_ui.bottom_panel_margin();
let mut panel_frame = ctx.re_ui.bottom_panel_frame();

if time_panel_expanded {
if state.is_expanded() {
// Since we use scroll bars we want to fill the whole vertical space downwards:
panel_frame.inner_margin.bottom = 0.0;

Expand Down Expand Up @@ -188,7 +189,7 @@ impl TimePanel {

egui::TopBottomPanel::show_animated_between_inside(
ui,
time_panel_expanded,
state.is_expanded(),
collapsed,
expanded,
|ui: &mut egui::Ui, expansion: f32| {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/blueprint.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include "./blueprint/components/grid_columns.fbs";
include "./blueprint/components/included_content.fbs";
include "./blueprint/components/included_space_view.fbs";
include "./blueprint/components/lock_range_during_zoom.fbs";
include "./blueprint/components/panel_expanded.fbs";
include "./blueprint/components/panel_state.fbs";
include "./blueprint/components/query_expression.fbs";
include "./blueprint/components/root_container.fbs";
include "./blueprint/components/row_share.fbs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ table PanelBlueprint (
// --- Required ---

// --- Optional ---
/// Whether or not the panel is expanded.
expanded: rerun.blueprint.components.PanelExpanded ("attr.rerun.component_optional", nullable, order: 1000);
state: rerun.blueprint.components.PanelState ("attr.rerun.component_optional", nullable, order: 1000);

// TODO(jleibs): Add a float to track how expanded the panel is.
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ namespace rerun.blueprint.components;

// ---

/// Whether an application panel is expanded or not.
struct PanelExpanded (
/// Tri-state for panel controls.
enum PanelState: byte (
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.derive": "Copy, PartialEq, Eq",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
) {
expanded: rerun.datatypes.Bool (order: 100);
/// Completely hidden.
Hidden,

/// Visible, but as small as possible on its shorter axis.
Collapsed,

/// Fully expanded.
Expanded,
}
2 changes: 1 addition & 1 deletion crates/re_types/src/blueprint/components/.gitattributes

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

5 changes: 3 additions & 2 deletions crates/re_types/src/blueprint/components/mod.rs

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

141 changes: 0 additions & 141 deletions crates/re_types/src/blueprint/components/panel_expanded.rs

This file was deleted.

Loading
Loading