From 8a8d34e06e6792e04d05828e74dac1f9aef746c1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:04:27 +0000 Subject: Only position sig with first mouse button git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@113 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../at/asit/pdfover/gui/composites/SignaturePanel.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 6d88460b..1c6a6e9c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -240,6 +240,8 @@ public class SignaturePanel extends JPanel { private MouseAdapter mouseListener = new MouseAdapter() { + private boolean doDrag = false; + private void updateSigPos(int sigx, int sigy) { if (SignaturePanel.this.currentImage == null) return; @@ -255,7 +257,17 @@ public class SignaturePanel extends JPanel { /** Handles a mousePressed event */ @Override public void mousePressed(MouseEvent evt) { - updateSigPos(evt.getX(), evt.getY()); + if (evt.getButton() == MouseEvent.BUTTON1) + { + updateSigPos(evt.getX(), evt.getY()); + this.doDrag = true; + } + } + + /** Handles a mouseReleased event */ + @Override + public void mouseReleased(MouseEvent evt) { + this.doDrag = false; } /** @@ -263,7 +275,8 @@ public class SignaturePanel extends JPanel { */ @Override public void mouseDragged(MouseEvent evt) { - updateSigPos(evt.getX(), evt.getY()); + if (this.doDrag) + updateSigPos(evt.getX(), evt.getY()); } }; -- cgit v1.2.3