summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotontrion <[email protected]>2025-02-19 13:53:02 +0100
committerGitHub <[email protected]>2025-02-19 13:53:02 +0100
commita0de1526d2de8a02feec1cba4086f284ec9f6098 (patch)
tree9e1c127b637690a2ee11e61c323c392c922849c0
parentcbfe69a9c22f3b0e59c6e09fffbe0b7af4f543d1 (diff)
Fix/circular progress (#289)
-rw-r--r--lib/astal/gtk3/src/widget/circularprogress.vala4
1 files changed, 3 insertions, 1 deletions
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);