switch arc_ccw true/false to arc_direction :counterclockwise/:clockwise
parent
573a1e9e30
commit
1a58adb288
|
|
@ -24,10 +24,10 @@ arc_end
|
|||
|
||||
angle on the circle to end an arc
|
||||
|
||||
arc_ccw
|
||||
default: ``false``
|
||||
arc_direction
|
||||
default: ``:clockwise``
|
||||
|
||||
draw the arc counterclockwise instead of clockwise
|
||||
draw the arc clockwise or counterclockwise from arc_start to arc_end
|
||||
|
||||
arc_close
|
||||
default: ``false``
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module Squib
|
|||
inner_radius: 50, outer_radius: 100,
|
||||
radius: 100,
|
||||
n: 5,
|
||||
arc_start: 0, arc_end: 2 * Math::PI, arc_ccw: false, arc_close: false,
|
||||
arc_start: 0, arc_end: 2 * Math::PI, arc_direction: :clockwise, arc_close: false,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,10 @@ module Squib
|
|||
def circle(box, draw)
|
||||
x, y, r = box.x, box.y, box.radius
|
||||
use_cairo do |cc|
|
||||
# cc.move_to(x + r, y)
|
||||
if box.arc_ccw
|
||||
cc.arc_negative(x, y, r, box.arc_start, box.arc_end)
|
||||
if box.arc_direction == :clockwise
|
||||
cc.arc(x, y, r, box.arc_start, box.arc_end)
|
||||
else
|
||||
cc.arc(x, y, r, box.arc_start, box.arc_end)
|
||||
cc.arc_negative(x, y, r, box.arc_start, box.arc_end)
|
||||
end
|
||||
if box.arc_close
|
||||
cc.close_path();
|
||||
|
|
|
|||
Loading…
Reference in New Issue