X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=sidebyside;f=lib%2FLaTeX%2FTikZ%2FMod%2FPattern%2FDots.pm;h=45714b1f3b0a5c71d1949594b0329067e85f8f48;hb=d819d3e4b5357f615a15c6c68c28b0612036ece8;hp=3fea8a6b08bd863e5b9384f64b05e83eb788dd1c;hpb=e8f0879ade07eed4f58cd52c0771f4e1ecc90b09;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm b/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm index 3fea8a6..45714b1 100644 --- a/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm +++ b/lib/LaTeX/TikZ/Mod/Pattern/Dots.pm @@ -18,18 +18,19 @@ our $VERSION = '0.01'; use Sub::Name (); use Any::Moose; +use Any::Moose 'Util::TypeConstraints'; extends 'LaTeX::TikZ::Mod::Pattern'; has 'dot_width' => ( is => 'ro', - isa => 'Int', + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), default => 1, ); has 'space_width' => ( is => 'ro', - isa => 'Int', + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), default => 1, ); @@ -53,16 +54,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};