]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Set/Union.pm
Add a backward compatible Tikz->path keyword
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Union.pm
index 2648d3d77223810556025bdb637b234fca8ff056..b13eb473c74000d2244c9cf9f4914d80163e63cb 100644 (file)
@@ -20,17 +20,17 @@ use LaTeX::TikZ::Functor;
 
 use LaTeX::TikZ::Tools;
 
-use Any::Moose;
+use Mouse;
 
 =head1 RELATIONSHIPS
 
-This class consumes the L<LaTeX::TikZ::Set::Path> and L<LaTeX::TikZ::Set::Mutable> roles, and as such implements the L</path> and L</add> methods.
+This class consumes the L<LaTeX::TikZ::Set::Path> and L<LaTeX::TikZ::Set::Container> roles, and as such implements the L</path>, L</kids> and L</add> methods.
 
 =cut
 
 with qw<
  LaTeX::TikZ::Set::Path
- LaTeX::TikZ::Set::Mutable
+ LaTeX::TikZ::Set::Container
 >;
 
 =head1 ATTRIBUTES
@@ -78,10 +78,41 @@ sub path {
  join ' ', map $_->path(@_), $set->kids;
 }
 
+=head2 C<begin>
+
+=cut
+
+sub begin {
+ my $set = shift;
+
+ my @kids = $set->kids;
+ return undef unless @kids;
+
+ $kids[0]->begin;
+}
+
+=head2 C<end>
+
+=cut
+
+sub end {
+ my $set = shift;
+
+ my @kids = $set->kids;
+ return undef unless @kids;
+
+ $kids[-1]->end;
+}
+
 LaTeX::TikZ::Interface->register(
  union => sub {
   shift;
 
+  __PACKAGE__->new(kids => \@_);
+ },
+ path  => sub {
+  shift;
+
   __PACKAGE__->new(kids => \@_);
  },
 );
@@ -97,7 +128,7 @@ __PACKAGE__->meta->make_immutable;
 
 =head1 SEE ALSO
 
-L<LaTeX::TikZ>, L<LaTeX::TikZ::Set::Path>, L<LaTeX::TikZ::Set::Mutable>.
+L<LaTeX::TikZ>, L<LaTeX::TikZ::Set::Path>, L<LaTeX::TikZ::Set::Container>.
 
 =head1 AUTHOR