Skip to content

Commit

Permalink
Remove egui_plot as dependency from re_sdk (#5099)
Browse files Browse the repository at this point in the history
### What
Part of #4788

We need to start tracking the number of dependencies and/or compile-time
of `re_sdk`: #5101.

@v-morlock pointed out in
https://github.com/rerun-io/rerun/issues/5095we accidentally pull in all
of `egui` 🤦

This PR fixes that.

---------

Co-authored-by: Clement Rey <[email protected]>
  • Loading branch information
emilk and teh-cmc authored Feb 7, 2024
1 parent d58f452 commit a0467a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion crates/re_entity_db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ re_types_core.workspace = true

ahash.workspace = true
document-features.workspace = true
egui_plot.workspace = true
emath.workspace = true
getrandom.workspace = true
itertools.workspace = true
Expand Down
11 changes: 0 additions & 11 deletions crates/re_entity_db/src/entity_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,6 @@ impl std::fmt::Display for LegendCorner {
}
}

impl From<LegendCorner> for egui_plot::Corner {
fn from(value: LegendCorner) -> Self {
match value {
LegendCorner::LeftTop => egui_plot::Corner::LeftTop,
LegendCorner::RightTop => egui_plot::Corner::RightTop,
LegendCorner::LeftBottom => egui_plot::Corner::LeftBottom,
LegendCorner::RightBottom => egui_plot::Corner::RightBottom,
}
}
}

// ----------------------------------------------------------------------------

/// What kind of aggregation should be performed when the zoom-level on the X axis goes below 1.0?
Expand Down
16 changes: 12 additions & 4 deletions crates/re_space_view_bar_chart/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,11 @@ impl SpaceViewClass for BarChartSpaceView {

if *root_entity_properties.show_legend {
plot = plot.legend(
Legend::default().position(
Legend::default().position(to_egui_plot_corner(
root_entity_properties
.legend_location
.unwrap_or(LegendCorner::RightTop)
.into(),
),
.unwrap_or(LegendCorner::RightTop),
)),
);
}

Expand Down Expand Up @@ -282,3 +281,12 @@ impl SpaceViewClass for BarChartSpaceView {
Ok(())
}
}

fn to_egui_plot_corner(value: LegendCorner) -> egui_plot::Corner {
match value {
LegendCorner::LeftTop => egui_plot::Corner::LeftTop,
LegendCorner::RightTop => egui_plot::Corner::RightTop,
LegendCorner::LeftBottom => egui_plot::Corner::LeftBottom,
LegendCorner::RightBottom => egui_plot::Corner::RightBottom,
}
}

0 comments on commit a0467a4

Please sign in to comment.