diff options
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover')
-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()); } }; |