summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:10:49 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:10:49 +0000
commit5b443ea391aee9a9340dbdbf990feea64f23e7a0 (patch)
tree2b6b7cfdb367755ac5fa4695fb2abea23bc33f08
parent5974b2267e2e0841305cbf76481fd2e5e3563d0a (diff)
downloadpdf-over-5b443ea391aee9a9340dbdbf990feea64f23e7a0.tar.gz
pdf-over-5b443ea391aee9a9340dbdbf990feea64f23e7a0.tar.bz2
pdf-over-5b443ea391aee9a9340dbdbf990feea64f23e7a0.zip
Workaround for wheel events firing twice
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@177 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index b7ed647d..defa846a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/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++;