X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=sidebyside;f=lib%2FLaTeX%2FTikZ%2FScope.pm;h=3686beb28b5e7f73d4b5302524f41b8d317b7fb8;hb=a2871e9a7be49f59dab5d64afab543404b1e13f4;hp=c07225962824d95eb027c538d991c3e09b18c79d;hpb=c314e50ea7c67844e6cf5f4d1431d8bf41a39f1a;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Scope.pm b/lib/LaTeX/TikZ/Scope.pm index c072259..3686beb 100644 --- a/lib/LaTeX/TikZ/Scope.pm +++ b/lib/LaTeX/TikZ/Scope.pm @@ -54,7 +54,8 @@ sub mod { my $cache = $scope->_mods_cache; for (@_) { - my $mod = $ltmf_tc->check($_) ? $_ : $ltmf_tc->coerce($_); + my $mod = $ltmf_tc->coerce($_); + $ltmf_tc->assert_valid($mod); my $tag = $mod->tag; next if exists $cache->{$tag}; $cache->{$tag} = $mod; @@ -181,7 +182,23 @@ sub fold { $right->_mods_cache, ); - if (@$common) { + my $has_different_layers; + for (@$only_left) { + if ($_->type eq 'layer') { + $has_different_layers = 1; + last; + } + } + unless ($has_different_layers) { + for (@$only_right) { + if ($_->type eq 'layer') { + $has_different_layers = 1; + last; + } + } + } + + if (!$has_different_layers and @$common) { my $x = $left->new ->mod(@$only_left) ->body($left->_body);