projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add release notes for 1.6.2
[fw/altos]
/
altosuilib
/
GrabNDrag.java
diff --git
a/altosuilib/GrabNDrag.java
b/altosuilib/GrabNDrag.java
index 5e5fdd5297b1930955c217f883ae7d1102b08087..d9f0c7fd321767c3cda17d174d07c193e80d333b 100644
(file)
--- a/
altosuilib/GrabNDrag.java
+++ b/
altosuilib/GrabNDrag.java
@@
-15,7
+15,7
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_
2
;
+package org.altusmetrum.altosuilib_
9
;
import java.awt.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.event.*;
@@
-33,16
+33,23
@@
class GrabNDrag extends MouseInputAdapter {
scroll.setAutoscrolls(true);
}
scroll.setAutoscrolls(true);
}
+ public static boolean grab_n_drag(MouseEvent e) {
+ return e.getModifiers() == InputEvent.BUTTON1_MASK;
+ }
+
public void mousePressed(MouseEvent e) {
public void mousePressed(MouseEvent e) {
- startPt.setLocation(e.getPoint());
+ if (grab_n_drag(e))
+ startPt.setLocation(e.getPoint());
}
public void mouseDragged(MouseEvent e) {
}
public void mouseDragged(MouseEvent e) {
- int xd = e.getX() - startPt.x;
- int yd = e.getY() - startPt.y;
+ if (grab_n_drag(e)) {
+ int xd = e.getX() - startPt.x;
+ int yd = e.getY() - startPt.y;
- Rectangle r = scroll.getVisibleRect();
- r.x -= xd;
- r.y -= yd;
- scroll.scrollRectToVisible(r);
+ Rectangle r = scroll.getVisibleRect();
+ r.x -= xd;
+ r.y -= yd;
+ scroll.scrollRectToVisible(r);
+ }
}
}
}
}