diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:04:27 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:04:27 +0000 |
commit | 8a8d34e06e6792e04d05828e74dac1f9aef746c1 (patch) | |
tree | 2c3705a290b72ce1e2dff72741fb9333240a68cc /pdf-over-gui/src/main | |
parent | fa61b95687478f74fef239595a8e1cbc63c18ef1 (diff) | |
download | pdf-over-8a8d34e06e6792e04d05828e74dac1f9aef746c1.tar.gz pdf-over-8a8d34e06e6792e04d05828e74dac1f9aef746c1.tar.bz2 pdf-over-8a8d34e06e6792e04d05828e74dac1f9aef746c1.zip |
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
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 17 |
1 files changed, 15 insertions, 2 deletions
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()); } }; |