From: Vincent Pit Date: Wed, 22 Apr 2015 19:23:06 +0000 (-0300) Subject: Reinstate the 'closed' parameter for Polyline X-Git-Tag: v0.03~8 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=134d77c279c20662ad5a3e8904e71572def1478e;p=perl%2Fmodules%2FLaTeX-TikZ.git Reinstate the 'closed' parameter for Polyline So that we preserve backcompat as much as possible. --- diff --git a/lib/LaTeX/TikZ/Set/Arc.pm b/lib/LaTeX/TikZ/Set/Arc.pm index 69fd1cf..ad3cd9b 100644 --- a/lib/LaTeX/TikZ/Set/Arc.pm +++ b/lib/LaTeX/TikZ/Set/Arc.pm @@ -72,7 +72,7 @@ LaTeX::TikZ::Interface->register( $set->clip( LaTeX::TikZ::Set::Polyline->new( points => [ $ua, @outside, $ub ], - cycle => 1, + closed => 1, ), ); }, diff --git a/lib/LaTeX/TikZ/Set/Polyline.pm b/lib/LaTeX/TikZ/Set/Polyline.pm index 445beb5..f982e91 100644 --- a/lib/LaTeX/TikZ/Set/Polyline.pm +++ b/lib/LaTeX/TikZ/Set/Polyline.pm @@ -56,14 +56,30 @@ has '+_kids' => ( coerce => 1, ); +=head2 C + +A boolean that indicates whether the polyline is closed or not. + +=cut + +has 'closed' => ( + is => 'ro', + isa => 'Bool', + required => 1, + default => 0, +); + sub points { @{$_[0]->_kids} } around 'BUILDARGS' => sub { my ($orig, $class, %args) = @_; + delete $args{cycle}; + $class->$orig( %args, connector => '--', + cycle => $args{closed}, ); }; @@ -71,14 +87,17 @@ LaTeX::TikZ::Interface->register( polyline => sub { shift; - __PACKAGE__->new(points => \@_); + __PACKAGE__->new( + points => \@_, + closed => 0, + ); }, closed_polyline => sub { shift; __PACKAGE__->new( points => \@_, - cycle => 1 + closed => 1, ); }, );