File: ScrollButtonScaler.pm

package info (click to toggle)
libpdl-graphics-trid-perl 2.102-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 476 kB
  • sloc: perl: 5,082; ansic: 683; makefile: 8
file content (31 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## ScrollButtonScaler -- this is the module that enables support
## for middle button scrollwheels to zoom in and out of the display
## window.  Scrolling forward zooms in, while scrolling backwards zooms
## out.

package PDL::Graphics::TriD::ScrollButtonScaler;
use base qw/PDL::Graphics::TriD::ButtonControl/;
use fields qw/DistRef Zoom/;

sub new {
  my($type,$win,$dist,$zoom) = @_;
  my $this = $type->SUPER::new($win);
  $this->{DistRef} = $dist;
  $this->{Zoom} = $zoom;  # multiplier for zooming
                          # >1 zooms out, <1 zooms in
  return $this;
}

sub ButtonRelease{
  my ($this,$x,$y) = @_;
  print "ButtonRelease @_\n"  if $PDL::Graphics::TriD::verbose;
  ${$this->{DistRef}} *= $this->{Zoom};
  1;
}

sub ButtonPress{
  my ($this,$x,$y) = @_;
  print "ButtonPress @_ ",ref($this->{Win}),"\n" if $PDL::Graphics::TriD::verbose;
}

1;