shape: Use an explicit move_to to set rounded_rect position
All other shape did it. While it usually have no side effects, as seen in #920 screenshot from @actionless, there is instances where this produce a invalid rectangle.
This commit is contained in:
parent
0c909e8d31
commit
441587a4de
|
@ -35,6 +35,7 @@ local module = {}
|
|||
-- @tparam number height The rectangle height
|
||||
-- @tparam number radius the corner radius
|
||||
function module.rounded_rect(cr, width, height, radius)
|
||||
|
||||
radius = radius or 10
|
||||
|
||||
if width / 2 < radius then
|
||||
|
@ -45,6 +46,8 @@ function module.rounded_rect(cr, width, height, radius)
|
|||
radius = height / 2
|
||||
end
|
||||
|
||||
cr:move_to(0, radius)
|
||||
|
||||
cr:arc( radius , radius , radius, math.pi , 3*(math.pi/2) )
|
||||
cr:arc( width-radius, radius , radius, 3*(math.pi/2), math.pi*2 )
|
||||
cr:arc( width-radius, height-radius, radius, math.pi*2 , math.pi/2 )
|
||||
|
|
Loading…
Reference in New Issue