From 49fb94fa25a2466ec597baa7531949d64482c41b Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 17 Dec 2024 12:43:54 +0100 Subject: [PATCH] Fix ui radius crashing graph view (#8502) --- crates/viewer/re_view_graph/src/visualizers/nodes.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/viewer/re_view_graph/src/visualizers/nodes.rs b/crates/viewer/re_view_graph/src/visualizers/nodes.rs index 2d7c1f0176da..b03a0c3121f6 100644 --- a/crates/viewer/re_view_graph/src/visualizers/nodes.rs +++ b/crates/viewer/re_view_graph/src/visualizers/nodes.rs @@ -3,7 +3,6 @@ use re_chunk::LatestAtQuery; use re_log_types::{EntityPath, Instance}; use re_query::{clamped_zip_2x4, range_zip_1x4}; use re_types::components::{Color, Radius, ShowLabels}; -use re_types::datatypes::Float32; use re_types::{ self, archetypes, components::{self}, @@ -23,6 +22,8 @@ pub struct NodeVisualizer { pub data: ahash::HashMap, } +pub const FALLBACK_RADIUS: f32 = 4.0; + /// The label information of a [`re_types::archetypes::GraphNodes`]. #[derive(Clone)] pub enum Label { @@ -120,7 +121,8 @@ impl VisualizerSystem for NodeVisualizer { color, }, _ => Label::Circle { - radius: radius.unwrap_or(4.0), + // Radius is negative for UI radii, but we don't handle this here. + radius: radius.unwrap_or(FALLBACK_RADIUS).abs(), color, }, }; @@ -160,7 +162,7 @@ impl TypedComponentFallbackProvider for NodeVisualizer { impl TypedComponentFallbackProvider for NodeVisualizer { fn fallback_for(&self, _ctx: &QueryContext<'_>) -> Radius { - Radius(Float32(4.0f32)) + FALLBACK_RADIUS.into() } }