@@ -13,37 +13,28 @@ use fields qw/X0 Y0 W H Transformer EHandler Active ResizeCommands
1313$PDL::Graphics::TriD::verbose //= 0;
1414
1515sub new {
16- my ($type ,$x0 ,$y0 ,$w ,$h ) = @_ ;
17-
18- my $this = $type -> SUPER::new();
19-
20- $this -> {X0 } = $x0 ;
21- $this -> {Y0 } = $y0 ;
22- $this -> {W } = $w ;
23- $this -> {H } = $h ;
24- $this -> {DefMaterial } = PDL::Graphics::TriD::Material-> new;
25-
26- return $this ;
16+ my $this = shift -> SUPER::new();
17+ $this -> {DefMaterial } = PDL::Graphics::TriD::Material-> new;
18+ $this -> resize(@_ );
2719}
2820
2921sub graph {
30- my ($this ,$graph ) = @_ ;
31- if (defined ($graph )){
32- $this -> add_object($graph );
33- push (@{$this -> {Graphs }},$graph );
34- }elsif (defined $this -> {Graphs }){
35- $graph = $this -> {Graphs }[0];
22+ my ($this ,$graph ) = @_ ;
23+ if (defined ($graph )) {
24+ $this -> add_object($graph );
25+ push (@{$this -> {Graphs }},$graph );
26+ } elsif (defined $this -> {Graphs }) {
27+ $graph = $this -> {Graphs }[0];
3628 }
37- return ( $graph ) ;
29+ $graph ;
3830}
3931
4032sub delete_graph {
41- my ($this ,$graph ) = @_ ;
42-
33+ my ($this ,$graph ) = @_ ;
4334 $this -> delete_object($graph );
44- for (0..$# {$this -> {Graphs }}){
45- if ($graph == $this -> {Graphs }[$_ ]){
46- splice ( @{$this -> {Graphs }},$_ ,1) ;
35+ for (0..$# {$this -> {Graphs }}){
36+ if ($graph == $this -> {Graphs }[$_ ]) {
37+ splice @{$this -> {Graphs }},$_ ,1;
4738 redo ;
4839 }
4940 }
@@ -56,10 +47,10 @@ sub resize {
5647}
5748
5849sub add_resizecommand {
59- my ($this ,$com ) = @_ ;
60- push @{$this -> {ResizeCommands }},$com ;
61- print " ARC: $this ->{W},$this ->{H}\n " if ( $PDL::Graphics::TriD::verbose ) ;
62- &$com ($this -> {W },$this -> {H });
50+ my ($this ,$com ) = @_ ;
51+ push @{$this -> {ResizeCommands }},$com ;
52+ print " ARC: $this ->{W},$this ->{H}\n " if $PDL::Graphics::TriD::verbose ;
53+ &$com ($this -> {W },$this -> {H });
6354}
6455
6556sub set_material {
@@ -68,10 +59,10 @@ sub set_material {
6859
6960sub eventhandler {
7061 my ($this ,$eh ) = @_ ;
71- if (defined $eh ){
72- $this -> {EHandler } = $eh ;
62+ if (defined $eh ) {
63+ $this -> {EHandler } = $eh ;
7364 }
74- return $this -> {EHandler };
65+ $this -> {EHandler };
7566}
7667
7768sub set_transformer {
@@ -81,9 +72,9 @@ sub set_transformer {
8172sub transformer {
8273 my ($this ,$t ) = @_ ;
8374 if (defined $t ){
84- $this -> {Transformer } = $t ;
75+ $this -> {Transformer } = $t ;
8576 }
86- return $this -> {Transformer };
77+ $this -> {Transformer };
8778}
8879
8980#
0 commit comments