X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FSet%2FChain.pm;h=d1022f842d4527513b3b9745a6a83b8d233f7bdf;hp=2c640c2821495cddc51ab9cb7a3e3db69bb21035;hb=7f9973057cc57660599aa4a093718cf343a48198;hpb=615913e4089427f90d33b25bd69534e202ae31ef diff --git a/lib/LaTeX/TikZ/Set/Chain.pm b/lib/LaTeX/TikZ/Set/Chain.pm index 2c640c2..d1022f8 100644 --- a/lib/LaTeX/TikZ/Set/Chain.pm +++ b/lib/LaTeX/TikZ/Set/Chain.pm @@ -16,6 +16,7 @@ Version 0.02 our $VERSION = '0.02'; use LaTeX::TikZ::Set::Point; +use LaTeX::TikZ::Set::Raw; use LaTeX::TikZ::Interface; use LaTeX::TikZ::Functor; @@ -116,6 +117,18 @@ has 'connector' => ( coerce => 1, ); +=head2 C + +A boolean that indicates whether the path is a cycle or not. + +=cut + +has 'cycle' => ( + is => 'ro', + isa => 'Bool', + default => 0, +); + =head1 METHODS =head2 C @@ -149,6 +162,12 @@ sub path { my $prev = $kids[0]; my $path = $prev->path($tikz); + if ($set->cycle) { + push @kids, LaTeX::TikZ::Set::Raw->new( + content => 'cycle', + ); + } + for my $i (1 .. $#kids) { my $next = $kids[$i]; my $link = $set->$conn($i - 1, $prev, $next, $tikz); @@ -223,6 +242,7 @@ LaTeX::TikZ::Functor->default_rule( $set->new( kids => [ map $_->$functor(@args), $set->kids ], connector => $set->connector, + cycle => $set->cycle, ); } );