From 41238b03f514480a593c586c1c9539727b535cda Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 20 Nov 2006 18:10:32 +0000 Subject: [PATCH 1/1] Mouse wheel to zoom --- src/jalview/gui/RotatableCanvas.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index b30dc34..9007e4f 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -79,6 +79,25 @@ public class RotatableCanvas extends JPanel implements MouseListener, public RotatableCanvas(AlignViewport av) { this.av = av; + + addMouseWheelListener(new MouseWheelListener() + { + public void mouseWheelMoved(MouseWheelEvent e) + { + if (e.getWheelRotation() > 0) + { + scale = (float) (scale * 1.1); + repaint(); + } + + else + { + scale = (float) (scale * 0.9); + repaint(); + } + } + }); + } public void showLabels(boolean b) -- 1.7.10.2