]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Set/Point.pm
Coerce Points into Set::Points
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Point.pm
index 58fb28c741a073b565512841ecba24a17a994abb..0a4911f88a80787829c5212db41d5eeb2174ae2e 100644 (file)
@@ -18,16 +18,21 @@ our $VERSION = '0.01';
 use LaTeX::TikZ::Point;
 
 use Any::Moose;
+use Any::Moose 'Util::TypeConstraints';
 
 with 'LaTeX::TikZ::Set::Op';
 
 has 'point' => (
  is       => 'ro',
does     => 'LaTeX::TikZ::Point::Autocoerce',
isa      => 'LaTeX::TikZ::Point::Autocoerce',
  required => 1,
  coerce   => 1,
 );
 
+coerce 'LaTeX::TikZ::Set::Point'
+    => from 'Any'
+    => via { __PACKAGE__->new(point => $_) };
+
 sub path {
  my ($set, $tikz) = @_;
 
@@ -39,7 +44,7 @@ sub path {
 use LaTeX::TikZ::Interface point => sub {
  shift;
 
- __PACKAGE__->new(point => $_[0]);
+ __PACKAGE__->new(point => @_ > 1 ? \@_ : $_[0] );
 };
 
 __PACKAGE__->meta->make_immutable;