From 9b3900b6cf0cd3f3df70466a0e9316138fc76439 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Wed, 20 Aug 2025 16:01:15 +0800 Subject: [PATCH] plot: Fix the full circle cannot be drawn (#1161) --- crates/ui/src/plot/shape/arc.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/plot/shape/arc.rs b/crates/ui/src/plot/shape/arc.rs index 31238eb6..eda6f43a 100644 --- a/crates/ui/src/plot/shape/arc.rs +++ b/crates/ui/src/plot/shape/arc.rs @@ -70,7 +70,14 @@ impl Arc { fn path(&self, arc: &ArcData, bounds: &Bounds) -> Option> { let start_angle = arc.start_angle - HALF_PI; let end_angle = arc.end_angle - HALF_PI; - let pad_angle = arc.pad_angle; + let da = end_angle - start_angle; + let pad_angle = if da >= PI { + // Leave some pad angle for full circle. + // If not, the path start and end will be the same point. + 0.0001 + } else { + arc.pad_angle + }; let r0 = self.inner_radius.max(0.); let r1 = self.outer_radius.max(0.); @@ -79,7 +86,6 @@ impl Arc { let center_y = bounds.origin.y.0 + bounds.size.height.0 / 2.; // Angle difference. - let da = end_angle - start_angle; if r1 < EPSILON || da.abs() < EPSILON { return None; }