From a0de1526d2de8a02feec1cba4086f284ec9f6098 Mon Sep 17 00:00:00 2001 From: kotontrion <141950090+kotontrion@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:53:02 +0100 Subject: Fix/circular progress (#289) --- lib/astal/gtk3/src/widget/circularprogress.vala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/astal/gtk3/src') diff --git a/lib/astal/gtk3/src/widget/circularprogress.vala b/lib/astal/gtk3/src/widget/circularprogress.vala index de7a5c7..9e5f82c 100644 --- a/lib/astal/gtk3/src/widget/circularprogress.vala +++ b/lib/astal/gtk3/src/widget/circularprogress.vala @@ -118,7 +118,7 @@ public class Astal.CircularProgress : Gtk.Bin { arc_length += 1; // Adjust for circular representation // Calculate the position on the arc based on the percentage value - var scaled = arc_length + value; + var scaled = value * arc_length; // Ensure the position is between 0 and 1 return (scaled % 1 + 1) % 1; @@ -192,6 +192,7 @@ public class Astal.CircularProgress : Gtk.Bin { } // Draw background + cr.new_sub_path(); cr.set_source_rgba(bg.red, bg.green, bg.blue, bg.alpha); cr.arc(center_x, center_y, radius, start_background, end_background); cr.set_line_width(bg_stroke); @@ -211,6 +212,7 @@ public class Astal.CircularProgress : Gtk.Bin { } // Draw progress + cr.new_sub_path(); cr.set_source_rgba(fg.red, fg.green, fg.blue, fg.alpha); cr.arc(center_x, center_y, radius, start_progress, end_progress); cr.set_line_width(fg_stroke); -- cgit v1.2.3