switch arc_ccw true/false to arc_direction :counterclockwise/:clockwise

This commit is contained in:
Clarence "Sparr" Risher
2017-03-10 22:48:21 -05:00
committed by Andy Meneely
parent 573a1e9e30
commit 1a58adb288
3 changed files with 7 additions and 8 deletions
+3 -3
View File
@@ -24,10 +24,10 @@ arc_end
angle on the circle to end an arc angle on the circle to end an arc
arc_ccw arc_direction
default: ``false`` default: ``:clockwise``
draw the arc counterclockwise instead of clockwise draw the arc clockwise or counterclockwise from arc_start to arc_end
arc_close arc_close
default: ``false`` default: ``false``
+1 -1
View File
@@ -17,7 +17,7 @@ module Squib
inner_radius: 50, outer_radius: 100, inner_radius: 50, outer_radius: 100,
radius: 100, radius: 100,
n: 5, 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 end
+3 -4
View File
@@ -18,11 +18,10 @@ module Squib
def circle(box, draw) def circle(box, draw)
x, y, r = box.x, box.y, box.radius x, y, r = box.x, box.y, box.radius
use_cairo do |cc| use_cairo do |cc|
# cc.move_to(x + r, y) if box.arc_direction == :clockwise
if box.arc_ccw cc.arc(x, y, r, box.arc_start, box.arc_end)
cc.arc_negative(x, y, r, box.arc_start, box.arc_end)
else 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 end
if box.arc_close if box.arc_close
cc.close_path(); cc.close_path();