has 'body' => (
is => 'ro',
- isa => 'LaTeX::TikZ::Scope|ArrayRef[Str]',
+ isa => 'ArrayRef[Str]',
required => 1,
init_arg => 'body',
);
}
}
+ my $body = $args{body};
+ if ($my_tc->check($body)) {
+ push @$mods, $body->mods;
+ $args{body} = $body->body;
+ }
+
+ $args{mods} = $mods;
+
$class->$orig(%args);
};
=head1 METHODS
-=head2 C<flatten>
-
=cut
-sub flatten {
- my ($scope) = @_;
-
- do {
- my $body = $scope->body;
- return $scope unless $my_tc->check($body);
- $scope = $scope->new(
- mods => [ $scope->mods, $body->mods ],
- body => $body->body,
- );
- } while (1);
-}
-
my $inter = Sub::Name::subname('inter' => sub {
my ($lh, $rh) = @_;
sub instantiate {
my ($scope) = @_;
- $scope = $scope->flatten;
-
my ($layer, @clips, @raw_mods);
for ($scope->mods) {
my $type = $_->type;
my (@left, @right);
if ($my_tc->check($left)) {
- $left = $left->flatten;
if ($my_tc->check($right)) {
- $right = $right->flatten;
my ($only_left, $common, $only_right) = $inter->(
$left->_mods_cache,