]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Mod/Pattern/Dots.pm
Bump the default space width of patterns to 10
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Mod / Pattern / Dots.pm
index 3fea8a6b08bd863e5b9384f64b05e83eb788dd1c..3698a2f58c0fbbe7b418577da4a85b39a952fbd4 100644 (file)
@@ -18,19 +18,36 @@ our $VERSION = '0.01';
 use Sub::Name ();
 
 use Any::Moose;
+use Any::Moose 'Util::TypeConstraints';
+
+=head1 RELATIONSHIPS
+
+This class inherits the L<LaTeX::TikZ::Mod::Pattern> class and its L<LaTeX::TikZ::Mod::Pattern/tag>, L<LaTeX::TikZ::Mod::Pattern/cover>, L<LaTeX::TikZ::Mod::Pattern/declare> and L<LaTeX::TikZ::Mod::Pattern/apply> methods.
+
+=cut
 
 extends 'LaTeX::TikZ::Mod::Pattern';
 
+=head1 ATTRIBUTES
+
+=head2 C<dot_width>
+
+=cut
+
 has 'dot_width' => (
  is      => 'ro',
- isa     => 'Int',
+ isa     => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }),
  default => 1,
 );
 
+=head2 C<space_width>
+
+=cut
+
 has 'space_width' => (
  is      => 'ro',
- isa     => 'Int',
- default => 1,
+ isa     => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }),
+ default => 10,
 );
 
 my $W = Sub::Name::subname('WIDTH' => sub { sprintf '#WIDTH=%0.1f#', @_ });
@@ -53,16 +70,16 @@ my $forge_template = Sub::Name::subname('forge_template' => sub {
  $center     = "\\pgfqpoint{$half_width}{$half_width}";
  $tile_size  = "\\pgfqpoint{$width}{$width}";
 
- <<" PATTERN";
-\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{%
- \\pgfpathcircle{$center}{$dot_width}
- \\pgfusepath{fill}
-}
- PATTERN
+ return [
+  "\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{",
+  "\\pgfpathcircle{$center}{$dot_width}",
+  "\\pgfusepath{fill}",
+  '}',
+ ];
 });
 
 around 'BUILDARGS' => sub {
- my ($orig, $class, %args);
+ my ($orig, $class, %args) = @_;
 
  confess('Can\'t specify an explicit template for a '. __PACKAGE__ .' pattern')
                                                       if exists $args{template};
@@ -83,6 +100,10 @@ around 'BUILDARGS' => sub {
 
 __PACKAGE__->meta->make_immutable;
 
+=head1 SEE ALSO
+
+L<LaTeX::TikZ>, L<LaTeX::TikZ::Mod::Pattern>.
+
 =head1 AUTHOR
 
 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.