Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start implementation of middle scrollbutton support for zoom
- Loading branch information
Showing
3 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
###################################################################### | ||
###################################################################### | ||
## ScrollButtonController -- 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::ScrollButtonController; | ||
use base qw/PDL::Graphics::TriD::ButtonControl/; | ||
use fields qw/Dist Zoom/; | ||
|
||
sub new { | ||
my($type,$win,$dist,$zoom) = @_; | ||
|
||
my $this = $type->SUPER::new($win); | ||
|
||
$this->{Dist} = $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; | ||
} | ||
|
||
sub ButtonPress{ | ||
my ($this,$x,$y) = @_; | ||
|
||
print "ButtonPress @_ ",ref($this->{Win}),"\n" if $PDL::Graphics::TriD::verbose; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters