From 1a58adb288b832740fe8d67a0912d548935c5d67 Mon Sep 17 00:00:00 2001 From: "Clarence \"Sparr\" Risher" Date: Thu, 2 Mar 2017 09:31:46 -0800 Subject: [PATCH] switch arc_ccw true/false to arc_direction :counterclockwise/:clockwise --- docs/dsl/circle.rst | 6 +++--- lib/squib/args/coords.rb | 2 +- lib/squib/graphics/shapes.rb | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/dsl/circle.rst b/docs/dsl/circle.rst index ef4c5bd..d893222 100644 --- a/docs/dsl/circle.rst +++ b/docs/dsl/circle.rst @@ -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`` diff --git a/lib/squib/args/coords.rb b/lib/squib/args/coords.rb index 8b555e5..9f908b5 100644 --- a/lib/squib/args/coords.rb +++ b/lib/squib/args/coords.rb @@ -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 diff --git a/lib/squib/graphics/shapes.rb b/lib/squib/graphics/shapes.rb index 680ad6a..08c6375 100644 --- a/lib/squib/graphics/shapes.rb +++ b/lib/squib/graphics/shapes.rb @@ -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();