Merge pull request #2610 from Elv13/arcchat_fixes
Fix the arcchart rounded edges
This commit is contained in:
commit
d25abddeb7
|
@ -472,8 +472,11 @@ function module.arc(cr, width, height, thickness, start_angle, end_angle, start_
|
|||
if end_rounded then
|
||||
arc_length = arc_length - thickness/2
|
||||
|
||||
-- And back to angles
|
||||
end_angle = start_angle + (arc_length/(radius - thickness/2))
|
||||
-- And back to angles. Also make sure to avoid underflowing when the
|
||||
-- rounded edge radius is greater than the angle delta.
|
||||
end_angle = start_angle + math.max(
|
||||
0, arc_length/(radius - thickness/2)
|
||||
)
|
||||
end
|
||||
|
||||
-- The path is a curcular arc joining 4 points
|
||||
|
|
|
@ -104,10 +104,11 @@ function arcchart:after_draw_children(_, cr, width, height)
|
|||
local max_val = self:get_max_value()
|
||||
local sum = 0
|
||||
|
||||
for _, v in ipairs(values) do
|
||||
sum = sum + v
|
||||
end
|
||||
|
||||
if not max_val then
|
||||
for _, v in ipairs(values) do
|
||||
sum = sum + v
|
||||
end
|
||||
max_val = sum
|
||||
end
|
||||
|
||||
|
@ -131,7 +132,7 @@ function arcchart:after_draw_children(_, cr, width, height)
|
|||
|
||||
shape.arc(cr, wa.width-border_width, wa.height-border_width,
|
||||
thickness+border_width, math.pi-end_angle, math.pi-start_angle,
|
||||
(use_rounded_edges and k == 1), (use_rounded_edges and k == #values)
|
||||
(use_rounded_edges and k == #values), (use_rounded_edges and k == 1)
|
||||
)
|
||||
|
||||
cr:fill()
|
||||
|
|
Loading…
Reference in New Issue