]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Set/Polyline.pm
Reinstate the 'closed' parameter for Polyline
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Polyline.pm
index e8e0ee0fe96e97c688e77a7d734c3305642583cf..f982e91e661b63c0c5cab6e59aebe277ddd07b41 100644 (file)
@@ -20,8 +20,8 @@ use LaTeX::TikZ::Set::Point;
 use LaTeX::TikZ::Interface;
 use LaTeX::TikZ::Functor;
 
-use Any::Moose;
-use Any::Moose 'Util::TypeConstraints';
+use Mouse;
+use Mouse::Util::TypeConstraints;
 
 =head1 RELATIONSHIPS
 
@@ -56,14 +56,30 @@ has '+_kids' => (
  coerce   => 1,
 );
 
+=head2 C<closed>
+
+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,
   );
  },
 );