diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:36:38 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-31 16:36:38 +0000 |
commit | 48e00df6935e61ed32767626084490a920dc0188 (patch) | |
tree | 3601eea9930233342a1f75a9c1afeb4130949f91 /trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites | |
parent | 8f2af4444822927a20dadcf902920f24e9100d5f (diff) | |
download | pdf-over-48e00df6935e61ed32767626084490a920dc0188.tar.gz pdf-over-48e00df6935e61ed32767626084490a920dc0188.tar.bz2 pdf-over-48e00df6935e61ed32767626084490a920dc0188.zip |
Only position sig with first mouse button
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12699 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 6d88460b..1c6a6e9c 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/trunk/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()); } }; |