X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FPattern%2FLines.pm;h=a86844020ded2e165e087dea465d31adf8fe87f5;hb=d819d3e4b5357f615a15c6c68c28b0612036ece8;hp=494817a0b41edc97dccb4c0bc6bd634e616878a8;hpb=e8f0879ade07eed4f58cd52c0771f4e1ecc90b09;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm b/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm index 494817a..a868440 100644 --- a/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm +++ b/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm @@ -36,13 +36,13 @@ has 'direction' => ( has 'line_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, ); @@ -89,18 +89,18 @@ my $forge_template = Sub::Name::subname('forge_template' => sub { return; } - <<" PATTERN"; -\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{% - \\pgfsetlinewidth{$line_width} - \\pgfpathmoveto{$line_begin} - \\pgfpathlineto{$line_end} - \\pgfusepath{stroke} -} - PATTERN + return [ + "\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{", + "\\pgfsetlinewidth{$line_width}", + "\\pgfpathmoveto{$line_begin}", + "\\pgfpathlineto{$line_end}", + "\\pgfusepath{stroke}", + "}", + ]; }); 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};