diff options
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/wheelOfFortune.pl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/wheelOfFortune.pl b/Perl/demos/Tk/demos/zinc_lib/wheelOfFortune.pl index d2fe155..cf117a5 100644 --- a/Perl/demos/Tk/demos/zinc_lib/wheelOfFortune.pl +++ b/Perl/demos/Tk/demos/zinc_lib/wheelOfFortune.pl @@ -274,7 +274,7 @@ sub _close { my $group = $self->{topgroup}; # first step of animation if ($cnt == 0) { - my @pos = $widget->coords($group)}; + my @pos = $widget->coords($group); $x = ($x - $pos[0])/$self->{stepsnumber}; $y = ($y - $pos[1])/$self->{stepsnumber}; # last step @@ -325,7 +325,7 @@ sub _fortune { my $zf; my $widget = $self->{widget}; my $group = $self->{topgroup}; - my @pos = $widget->coords($group)}; + my @pos = $widget->coords($group); # last step of animation if ($cnt == 6) { $self->{fortune} = undef; @@ -356,11 +356,17 @@ sub _fortune { # Update group clipping and translation, using 'scale' and 'translate' # Zinc methods. sub _clipAndTranslate { + my ($self, $shrinkfactor, $x, $y) = @_; $x = 0 unless $x; $y = 0 unless $y; $self->{widget}->scale($self->{itemclip}, $shrinkfactor, $shrinkfactor); - $self->{widget}->translate($self->{topgroup}, $x, $y); + if ($Tk::Zinc::VERSION lt "3.297") { + $self->{widget}->translate($self->{topgroup}, $x, $y); + } else { + my ($xc, $yc) = $self->{widget}->coords($self->{topgroup}); + $self->{widget}->coords($self->{topgroup}, [$xc + $x, $yc + $y]); + } } |