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 manually setting full span scopes #6509

Merged
merged 1 commit into from
Jun 5, 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
26 changes: 13 additions & 13 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30"
[[package]]
name = "ecolor"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"bytemuck",
"serde",
Expand All @@ -1573,7 +1573,7 @@ dependencies = [
[[package]]
name = "eframe"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -1609,7 +1609,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -1626,7 +1626,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -1645,7 +1645,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"accesskit_winit",
"ahash",
Expand All @@ -1664,7 +1664,7 @@ dependencies = [
[[package]]
name = "egui_commonmark"
version = "0.16.1"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=11a04af9177214f4cb7dce3733d1e14f6890ceb9#11a04af9177214f4cb7dce3733d1e14f6890ceb9"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=63d5c8933445b9ea9088c4a50b71f4ede1f3c247#63d5c8933445b9ea9088c4a50b71f4ede1f3c247"
dependencies = [
"egui",
"egui_commonmark_backend",
Expand All @@ -1675,7 +1675,7 @@ dependencies = [
[[package]]
name = "egui_commonmark_backend"
version = "0.16.1"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=11a04af9177214f4cb7dce3733d1e14f6890ceb9#11a04af9177214f4cb7dce3733d1e14f6890ceb9"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=63d5c8933445b9ea9088c4a50b71f4ede1f3c247#63d5c8933445b9ea9088c4a50b71f4ede1f3c247"
dependencies = [
"egui",
"egui_extras",
Expand All @@ -1685,7 +1685,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ahash",
"egui",
Expand All @@ -1701,7 +1701,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -1719,7 +1719,7 @@ dependencies = [
[[package]]
name = "egui_plot"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ahash",
"egui",
Expand All @@ -1728,7 +1728,7 @@ dependencies = [
[[package]]
name = "egui_tiles"
version = "0.8.0"
source = "git+https://github.com/rerun-io/egui_tiles?rev=7ed84adfa20e1a62d1a1da75a6083d3fc194164d#7ed84adfa20e1a62d1a1da75a6083d3fc194164d"
source = "git+https://github.com/rerun-io/egui_tiles?rev=cd8a1acdfca67e0b98ebc5722ee89b74bb20f5d3#cd8a1acdfca67e0b98ebc5722ee89b74bb20f5d3"
dependencies = [
"ahash",
"egui",
Expand Down Expand Up @@ -1762,7 +1762,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "emath"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -1863,7 +1863,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.27.2"
source = "git+https://github.com/emilk/egui.git?rev=a28792194ddacbdb8012dafa49cdfb84c6a3ba65#a28792194ddacbdb8012dafa49cdfb84c6a3ba65"
source = "git+https://github.com/emilk/egui.git?rev=cbb5d6aa936c7498214dba03b594fbe75dbe7488#cbb5d6aa936c7498214dba03b594fbe75dbe7488"
dependencies = [
"ab_glyph",
"ahash",
Expand Down
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,13 @@ missing_errors_doc = "allow"
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

ecolor = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
eframe = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
egui = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
egui_plot = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
emath = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012dafa49cdfb84c6a3ba65" } # egui master 2024-06-04
ecolor = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
eframe = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
egui = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
egui_plot = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
emath = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand All @@ -471,6 +471,6 @@ emath = { git = "https://github.com/emilk/egui.git", rev = "a28792194ddacbdb8012
# egui-wgpu = { path = "../../egui/crates/egui-wgpu" }
# emath = { path = "../../egui/crates/emath" }

egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "7ed84adfa20e1a62d1a1da75a6083d3fc194164d" } # main 2024-06-04, which works with egui master
egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "cd8a1acdfca67e0b98ebc5722ee89b74bb20f5d3" } # main 2024-06-05, which works with egui master

egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "11a04af9177214f4cb7dce3733d1e14f6890ceb9" } # https://github.com/lampsitter/egui_commonmark/pull/51
egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "63d5c8933445b9ea9088c4a50b71f4ede1f3c247" } # https://github.com/lampsitter/egui_commonmark/pull/51
31 changes: 13 additions & 18 deletions crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,25 +443,20 @@ impl TimePanel {
ui.min_rect().bottom()..=ui.max_rect().bottom(),
));

//TODO(ab): using clip rect here should be replaced by a better mechanism based on `UiStack`
let old_clip_rect = ui.clip_rect();
ui.set_clip_rect(egui::Rect::from_x_y_ranges(
0.0..=time_x_left,
ui.max_rect().y_range(),
));
// All the entity rows and their data density graphs:
list_item::list_item_scope(ui, "streams_tree", |ui| {
self.tree_ui(
ctx,
viewport_blueprint,
entity_db,
time_ctrl,
&time_area_response,
&lower_time_area_painter,
ui,
);
// All the entity rows and their data density graphs
ui.full_span_scope(0.0..=time_x_left, |ui| {
list_item::list_item_scope(ui, "streams_tree", |ui| {
self.tree_ui(
ctx,
viewport_blueprint,
entity_db,
time_ctrl,
&time_area_response,
&lower_time_area_painter,
ui,
);
});
});
ui.set_clip_rect(old_clip_rect);

{
// Paint a shadow between the stream names on the left
Expand Down
30 changes: 28 additions & 2 deletions crates/re_ui/src/ui_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::{
ContextExt, DesignTokens, Icon, LabelStyle,
};

static FULL_SPAN_TAG: &str = "rerun_full_span";

/// Rerun custom extensions to [`egui::Ui`].
pub trait UiExt {
fn ui(&self) -> &egui::Ui;
Expand Down Expand Up @@ -1003,15 +1005,39 @@ pub trait UiExt {
});
}

/// Use the provided range as full span for the nested content.
///
/// See [`Self::full_span`] for details.
fn full_span_scope<R>(
&mut self,
span: impl Into<egui::Rangef>,
content: impl FnOnce(&mut egui::Ui) -> R,
) -> R {
self.ui_mut()
.push_stack_info(
egui::UiStackInfo::default().with_tag_value(FULL_SPAN_TAG, span.into()),
content,
)
.inner
}

/// Retrieve the current full-span scope.
///
/// By default, this method uses a heuristics to identify which parent `Ui`'s boundary should be
/// used (e.g. top-level panel, tooltip, etc.). Use [`Self::full_span_scope`] to set a specific
/// range as full span.
fn full_span(&self) -> egui::Rangef {
for node in self.ui().stack().iter() {
if let Some(span) = node.tags().get_downcast(FULL_SPAN_TAG) {
return *span;
}

if node.has_visible_frame()
|| node.is_panel_ui()
|| node.is_root_ui()
|| node.kind == Some(egui::UiKind::TableCell)
|| node.kind() == Some(egui::UiKind::TableCell)
{
return (node.max_rect + node.frame.inner_margin).x_range();
return (node.max_rect + node.frame().inner_margin).x_range();
}
}

Expand Down
Loading