diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:37:02 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:37:02 +0000 |
commit | 72d3fd1cdb62a066a933b0786c8d5b6e9a339100 (patch) | |
tree | 489d2ce273562a22ce709510c785feaeeae2fe33 | |
parent | 5f1ed352e4cbf65c84f2c2704a74ba9acbaca3d3 (diff) | |
download | pdf-over-72d3fd1cdb62a066a933b0786c8d5b6e9a339100.tar.gz pdf-over-72d3fd1cdb62a066a933b0786c8d5b6e9a339100.tar.bz2 pdf-over-72d3fd1cdb62a066a933b0786c8d5b6e9a339100.zip |
Workaround for wheel events firing twice
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12763 3a0b52a2-8410-0410-bc02-ff6273a87459
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index b7ed647d..defa846a 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -237,16 +237,22 @@ public class PositioningComposite extends StateComposite { }; private MouseWheelListener mouseListener = new MouseWheelListener() { + private long lastEventTime = 0; + @Override public void mouseWheelMoved(MouseWheelEvent e) { + if (e.getWhen() == this.lastEventTime) + return; + this.lastEventTime = e.getWhen(); + int newPage = PositioningComposite.this.currentPage; - if (e.getUnitsToScroll() < 0) + if (e.getWheelRotation() < 0) { if (PositioningComposite.this.currentPage > 1) newPage--; } - else if (e.getUnitsToScroll() > 0) + else if (e.getWheelRotation() > 0) { if (PositioningComposite.this.currentPage < PositioningComposite.this.numPages) newPage++; |