Changeset 12778 in osm for applications/editors/josm/plugins/nearclick
- Timestamp:
- 2009-01-01T18:28:53+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java
r4088 r12778 20 20 public NearClickPlugin() { 21 21 Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 22 23 24 25 26 27 28 29 22 try { 23 int radius = Integer.parseInt(Main.pref.get("nearclick.radius", "7")); 24 radiussquared = radius * radius; 25 delay = Integer.parseInt(Main.pref.get("nearclick.delay", "250")); 26 } catch (NumberFormatException ex) { 27 delay = 250; 28 radiussquared = 7 * 7; 29 } 30 30 } 31 31 … … 35 35 if ( e.getButton() != MouseEvent.BUTTON1 ) 36 36 return; 37 38 39 37 int xdiff = e.getPoint().x - mouseDownX; 38 int ydiff = e.getPoint().y - mouseDownY; 39 40 40 if (e.getID() == MouseEvent.MOUSE_RELEASED) { 41 41 if ( e.getWhen() - mouseDownTime < delay && 42 43 44 45 42 ( e.getPoint().x != mouseDownX || 43 e.getPoint().y != mouseDownY) && 44 xdiff * xdiff + ydiff * ydiff < radiussquared 45 ) { 46 46 try { 47 47 Robot r = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
Note:
See TracChangeset
for help on using the changeset viewer.