From ebe38527b9c8c9e59243cff63f80ce6abea351cc Mon Sep 17 00:00:00 2001 From: vinot Date: Fri, 2 Apr 2004 14:40:18 +0000 Subject: correction interaction rotatePolygone -> modif de Graphics::lineAngle() --- Perl/demos/Tk/demos/zinc_lib/testGraphics.pl | 79 ++-------------------------- 1 file changed, 4 insertions(+), 75 deletions(-) (limited to 'Perl/demos') diff --git a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl index a763431..e1fc7f9 100644 --- a/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl +++ b/Perl/demos/Tk/demos/zinc_lib/testGraphics.pl @@ -14,8 +14,7 @@ use vars qw( $VERSION ); use Tk; use Tk::Zinc; -#use Tk::Zinc::Graphics; -use Graphics; +use Tk::Zinc::Graphics; use Math::Trig; use Getopt::Long; use strict 'vars'; @@ -1471,16 +1470,6 @@ $zinc->pack(-fill => 'both', -expand => 1); # initialise les gradients nommés &setGradients($zinc, \%gradset); -# initialise les images de fontes -while (my ($anchor, $table) = each(%tabtable)) { - my @images; - foreach my $filename (@{$table->{'-images'}}) { - my $image = $zinc->Photo(-file => Tk::findINC($filename)); - push(@images, $image); - } - $tabtable{$anchor}->{'-images'} = \@images; -} - # création de la vue principale my $tgroup = $zinc->add('group', 1); $zinc->coords($tgroup, [350, 240]); @@ -1504,8 +1493,7 @@ my ($shapes, $tcoords) = &tabBoxCoords([[-315, -210],[315, 210]], ); # to find some images (used as textures) needed by this demo -push @INC , Tk->findINC('demos/zinc_data'); -my $texture = $zinc->Photo(-file => Tk::findINC('paper.gif')); +my $texture = $zinc->Photo('paper.gif', -file => Tk->findINC('demos/zinc_data/paper.gif')); # création des items zinc correspondants my $i = scalar(@{$shapes}) - 1; @@ -1763,7 +1751,7 @@ sub pullButton { sub startRotatePolygone { my $ev = $zinc->XEvent; my ($xref, $yref) = $zinc->transform($zinc->group('current'), 1, [0, 0]); - $previousangle = &lineAngle($ev->x, $ev->y, $xref, $yref); + $previousangle = &lineAngle([$ev->x, $ev->y], [$xref, $yref]); } #----------------------------------------------------------------------------------- @@ -1774,7 +1762,7 @@ sub rotatePolygone { my $tag = ($zinc->itemcget('current', -tags))[0]; my $ev = $zinc->XEvent; my ($xref, $yref) = $zinc->transform($zinc->group('current'), 1, [0, 0]); - my $newangle = &lineAngle($ev->x, $ev->y, $xref, $yref); + my $newangle = &lineAngle([$ev->x, $ev->y], [$xref, $yref]); $zinc->rotate($tag, deg2rad($newangle - $previousangle)); $previousangle = $newangle; @@ -1853,64 +1841,5 @@ sub viewRotate { } -# #----------------------------------------------------------------------------------- -# # création d'une TabBox -# #----------------------------------------------------------------------------------- -# sub buildTabBox { -# my ($zinc, $parentgroup, $style, $name) = @_; -# my $params = delete $style->{'-params'}; -# my @tags = @{$params->{'-tags'}}; -# my $coords = delete $style->{'-coords'}; -# my $table = $tabtable{$style->{'-anchor'}}; -# my $titles = $style->{'-tabtitles'}; -# my ($shapes, $tcoords, $invert) = &tabBoxCoords($coords, %{$style}); -# my $k = ($invert) ? scalar @{$shapes} : -1; -# foreach my $shape (reverse @{$shapes}) { -# $k += ($invert) ? -1 : +1; -# my $group = $zinc->add('group', $parentgroup); -# $params->{'-tags'} = [$tags[0], $k, $tags[1], 'intercalaire']; -# $zinc->add('curve', $group, $shape, %{$params}); - -# if ($style->{'-page'}) { -# &buildZincItem($zinc, $group, %{$style->{'-page'}}); -# } - -# my $tindex = ($invert) ? $k : $#{$shapes} - $k; -# if ($titles) { -# my $titltags = [$tags[0], $k, $tags[1], 'titre']; -# $zinc->add('text', $group, -# -position => $tcoords->[$tindex], -# -text => $titles->[$tindex], -# -font => $font_9b, -# -alignment => 'center', -# -anchor => 'center', -# -color => '#000099', -# -priority => 200, -# -tags => $titltags, -# ); - -# } - -# # exemple fonte -# if ($tindex == 0) { -# $zinc->add('text', $parentgroup, -# -position => [-165, -105], -# -text => $table->{'-names'}->[0], -# -font => $font_9b, -# -alignment => 'left', -# -anchor => 'nw', -# -color => '#000000', -# -priority => 500, -# -width => 350, -# -tags => [$tags[0], 'fontname'], -# ); - -# } - -# } - -# &selectDivider($tags[0], $k); -# } - 1; -- cgit v1.1