Skip to content
Merged
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
13 changes: 9 additions & 4 deletions crates/component/src/chart/pie_chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ impl<T> Plot for PieChart<T> {
let label_arc = Arc::new()
.inner_radius(label_radius)
.outer_radius(label_radius);
let edge_arc = Arc::new()
.inner_radius(outer_radius)
.outer_radius(outer_radius);

let label_color = self.label_color.unwrap_or(cx.theme().foreground);
let default_line_color = cx.theme().border;
Expand All @@ -309,7 +306,15 @@ impl<T> Plot for PieChart<T> {
}

let centroid = label_arc.centroid(a);
let edge = edge_arc.centroid(a);
// Anchor the line on the edge the slice reaches this frame, so a
// lifted slice never paints over its own leader line. The label
// anchor stays put, so the line may not start past it.
let (lift, _) = self.slice_emphasis(a.index);
let edge_radius = (outer_radius + HOVER_LIFT * lift).min(label_radius);
let edge = Arc::new()
.inner_radius(edge_radius)
.outer_radius(edge_radius)
.centroid(a);
let is_right = centroid.x > 0.;
let line_color = self
.label_line_color
Expand Down
Loading