Changeset 4088 in osm for applications/editors/josm/plugins
- Timestamp:
- 2007-08-12T13:08:46+02:00 (17 years ago)
- Location:
- applications/editors/josm/plugins/nearclick
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/nearclick/.classpath
r2397 r4088 3 3 <classpathentry kind="src" path="src"/> 4 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 5 <classpathentry combineaccessrules="false" kind="src" path="/josm"/> 5 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 6 <classpathentry kind="src" path="/josm"/> 6 7 <classpathentry kind="output" path="bin"/> 7 8 </classpath> -
applications/editors/josm/plugins/nearclick/.project
r2397 r4088 11 11 </arguments> 12 12 </buildCommand> 13 <buildCommand> 14 <name>org.eclipse.pde.ManifestBuilder</name> 15 <arguments> 16 </arguments> 17 </buildCommand> 18 <buildCommand> 19 <name>org.eclipse.pde.SchemaBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 13 23 </buildSpec> 14 24 <natures> 15 25 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>org.eclipse.pde.PluginNature</nature> 16 27 </natures> 17 28 </projectDescription> -
applications/editors/josm/plugins/nearclick/build.xml
r3789 r4088 8 8 <!-- Windows has a different home directory scheme then unix/linux --> 9 9 <!-- I don't know an automatic way to find it with ant :-(, if you know, please fix --> 10 < property name="plugins" location="${user.home}/.josm/plugins" ></property>11 < !--<property name="plugins" location="${user.home}/Anwendungsdaten/JOSM/plugins" ></property>-->10 <!--<property name="plugins" location="${user.home}/.josm/plugins" ></property>--> 11 <property name="plugins" location="${user.home}/Application Data/JOSM/plugins" ></property> 12 12 13 13 <!-- you should not need to modify anything below this! --> … … 20 20 21 21 <target name="compile" depends="init"> 22 <javac srcdir="src" classpath="${josm}" destdir="build" debug="true">22 <javac srcdir="src" target="1.5" classpath="${josm}" destdir="build" debug="true"> 23 23 <include name="**/*.java" /> 24 24 </javac> -
applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java
r2397 r4088 8 8 import java.awt.event.AWTEventListener; 9 9 import java.awt.event.MouseEvent; 10 import org.openstreetmap.josm.Main; 10 11 11 12 public class NearClickPlugin implements AWTEventListener { … … 14 15 private int mouseDownY = -1; 15 16 private long mouseDownTime = -1; 17 private int radiussquared = 49; 18 private int delay = 250; 16 19 17 20 public NearClickPlugin() { 18 21 Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 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 } 19 30 } 20 31 … … 24 35 if ( e.getButton() != MouseEvent.BUTTON1 ) 25 36 return; 37 int xdiff = e.getPoint().x - mouseDownX; 38 int ydiff = e.getPoint().y - mouseDownY; 39 26 40 if (e.getID() == MouseEvent.MOUSE_RELEASED) { 27 if ( e.getWhen() - mouseDownTime < 250&&28 e.getPoint().x - mouseDownX < 7 && 29 e.getPoint().y - mouseDownY < 7&&30 e.getPoint().x != mouseDownX && 31 e.getPoint().y != mouseDownY) {41 if ( e.getWhen() - mouseDownTime < delay && 42 ( e.getPoint().x != mouseDownX || 43 e.getPoint().y != mouseDownY) && 44 xdiff * xdiff + ydiff * ydiff < radiussquared 45 ) { 32 46 try { 33 47 Robot r = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
Note:
See TracChangeset
for help on using the changeset viewer.