From 48e00df6935e61ed32767626084490a920dc0188 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 31 Oct 2012 16:36:38 +0000 Subject: 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 --- .../at/asit/pdfover/gui/composites/SignaturePanel.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'trunk') 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()); } }; -- cgit v1.2.3