diff options
-rw-r--r-- | src/MTools/GUI/MTexture.pm | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/MTools/GUI/MTexture.pm b/src/MTools/GUI/MTexture.pm index 82c7d2d..13ad4aa 100644 --- a/src/MTools/GUI/MTexture.pm +++ b/src/MTools/GUI/MTexture.pm @@ -56,18 +56,34 @@ sub new { mdelete ($image); + my @images_list; for (my $x = 0; $x < $w; $x += $img_w) { for (my $y = 0; $y < $h; $y += $img_h) { - $image = new MTools::GUI::MImage ($self, $image_name); - $image -> translate ($x + $bb [0], $y + $bb [1]); + $image = new MTools::GUI::MImage ($self, $image_name); + $image -> translate ($x + $bb [0], $y + $bb [1]); + push @images_list, $image; } } my $clip = clone ($target); mconfigure ($clip, -visible => 0); - new MTools::GUI::MClip ($self, $clip); + if (type ($clip) eq 'group') { + my $texture = new MTools::GUI::MGroup($self); + foreach (@images_list) { + chggroup($_, $texture); + } + foreach ($zinc->find('withtag', ".$clip*")) { + if (type ($_) ne 'group') { + mconfigure ($_, -visible => 0); + new MTools::GUI::MClip (clone($texture), $_); + } + } + mdelete($texture); + } else { + new MTools::GUI::MClip ($self, $clip); + } return $self; } |