Browse Source

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

dev
Clarence "Sparr" Risher 9 years ago committed by Andy Meneely
parent
commit
1a58adb288
  1. 6
      docs/dsl/circle.rst
  2. 2
      lib/squib/args/coords.rb
  3. 7
      lib/squib/graphics/shapes.rb

6
docs/dsl/circle.rst

@ -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``

2
lib/squib/args/coords.rb

@ -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

7
lib/squib/graphics/shapes.rb

@ -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();

Loading…
Cancel
Save