Ticket #2287: JOSM.Select.patch
| File JOSM.Select.patch, 1.6 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/NavigatableComponent.java
149 149 150 150 /** 151 151 * Return the nearest point to the screen point given. 152 * If a node within 10pixel is found, the nearest node is returned.152 * If a node within snapDistance pixel is found, the nearest node is returned. 153 153 */ 154 154 public final Node getNearestNode(Point p) { 155 155 double minDistanceSq = Double.MAX_VALUE; … … 159 159 continue; 160 160 Point sp = getPoint(n.eastNorth); 161 161 double dist = p.distanceSq(sp); 162 if ( minDistanceSq > dist && dist < snapDistance) {163 minDistanceSq = p.distanceSq(sp);162 if (dist < snapDistance && dist < minDistanceSq) { 163 minDistanceSq = dist; 164 164 minPrimitive = n; 165 165 } 166 // prefer already selected node when multiple nodes on one point 167 else if(minDistanceSq == dist && n.selected && !minPrimitive.selected) 166 // when multiple nodes on one point, prefer nodes later 167 // in the list (i.e. newer nodes) except when the current minimum 168 // is an already selected node 169 else if (dist == minDistanceSq) 168 170 { 169 minPrimitive = n; 171 if (!minPrimitive.selected) 172 minPrimitive = n; 170 173 } 171 174 } 172 175 return minPrimitive;
