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,
);
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};