ButtonControl.pm (PDL-2.077) | : | ButtonControl.pm (PDL-2.078) | ||
---|---|---|---|---|
skipping to change at line 75 | skipping to change at line 75 | |||
=head2 ButtonRelease | =head2 ButtonRelease | |||
=for ref | =for ref | |||
A do nothing function to prevent errors if not defined in a subclass | A do nothing function to prevent errors if not defined in a subclass | |||
=cut | =cut | |||
sub ButtonRelease{ | sub ButtonRelease{ | |||
my ($this,$x,$y) = @_; | my ($this,$x,$y) = @_; | |||
$this->{Win}{Active} = 0; | ||||
print "ButtonRelease @_\n" if $PDL::Graphics::TriD::verbose; | print "ButtonRelease @_\n" if $PDL::Graphics::TriD::verbose; | |||
$this->{Win}{Active} = 0; | ||||
} | } | |||
=head2 ButtonPress | =head2 ButtonPress | |||
=for ref | =for ref | |||
Activates the viewport the mouse is inside when pressed | Activates the viewport the mouse is inside when pressed | |||
=cut | =cut | |||
$PDL::Graphics::TriD::current_window = $PDL::Graphics::TriD::current_window; # w arnings | $PDL::Graphics::TriD::current_window = $PDL::Graphics::TriD::current_window; # w arnings | |||
sub ButtonPress{ | sub ButtonPress{ | |||
my ($this,$x,$y) = @_; | my ($this,$x,$y) = @_; | |||
print "ButtonPress @_ ",ref($this->{Win}),"\n" if $PDL::Graphics::TriD::verbos e; | ||||
# | # | |||
# GL (0,0) point is Lower left X and Tk is upper left. | # GL (0,0) point is Lower left X and Tk is upper left. | |||
# | # | |||
$y = $PDL::Graphics::TriD::current_window->{Height}-$y; | $y = $PDL::Graphics::TriD::current_window->{Height}-$y; | |||
# print "$x $y ",$this->{Win}{X0}," ",$this->{Win}{Y0}," ",$this->{Win}{W}," ", $this->{Win}{H},"\n"; | # print "$x $y ",$this->{Win}{X0}," ",$this->{Win}{Y0}," ",$this->{Win}{W}," ", $this->{Win}{H},"\n"; | |||
if($this->{Win}{X0} <= $x && $this->{Win}{X0}+$this->{Win}{W}>=$x | if($this->{Win}{X0} <= $x && $this->{Win}{X0}+$this->{Win}{W}>=$x | |||
&& $this->{Win}{Y0} <= $y && $this->{Win}{Y0}+$this->{Win}{H}>=$y ){ | && $this->{Win}{Y0} <= $y && $this->{Win}{Y0}+$this->{Win}{H}>=$y ){ | |||
$this->{Win}{Active} = 1; | $this->{Win}{Active} = 1; | |||
} | } | |||
print "ButtonPress @_ ",ref($this->{Win}),"\n" if $PDL::Graphics::TriD::verbos e; | ||||
} | } | |||
=head2 set_wh | =head2 set_wh | |||
=for ref | =for ref | |||
Define the width and Height of the window for button control | Define the width and Height of the window for button control | |||
=cut | =cut | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |