Changeset 1911 in josm for trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
- Timestamp:
- 2009-08-05T10:05:50+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r1910 r1911 145 145 */ 146 146 public void mousePressed(MouseEvent e) { 147 if (e.getButton() == MouseEvent.BUTTON1) 147 if (e.getButton() == MouseEvent.BUTTON1) { 148 148 mousePosStart = mousePos = e.getPoint(); 149 } 149 150 } 150 151 … … 157 158 158 159 if (buttonPressed != 0) { 159 if (mousePosStart == null) 160 if (mousePosStart == null) { 160 161 mousePosStart = mousePos = e.getPoint(); 162 } 161 163 paintRect(); 162 164 } … … 191 193 boolean alt = (e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) != 0; 192 194 boolean ctrl = (e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0; 193 if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == 0) 195 if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == 0) { 194 196 selectionEndedListener.selectionEnded(r, alt, shift, ctrl); 197 } 195 198 } 196 199 … … 235 238 if ((double)w/h < aspectRatio) { 236 239 int neww = (int)(h*aspectRatio); 237 if (mousePos.x < mousePosStart.x) 240 if (mousePos.x < mousePosStart.x) { 238 241 x += w - neww; 242 } 239 243 w = neww; 240 244 } else { 241 245 int newh = (int)(w/aspectRatio); 242 if (mousePos.y < mousePosStart.y) 246 if (mousePos.y < mousePosStart.y) { 243 247 y += h - newh; 248 } 244 249 h = newh; 245 250 } … … 275 280 if (clicked) { 276 281 OsmPrimitive osm = nc.getNearest(center); 277 if (osm != null) 282 if (osm != null) { 278 283 selection.add(osm); 284 } 279 285 } else { 280 286 // nodes 281 287 for (Node n : nc.getCurrentDataSet().nodes) { 282 if (!n.deleted && !n.incomplete && r.contains(nc.getPoint(n))) 288 if (!n.deleted && !n.incomplete && r.contains(nc.getPoint(n))) { 283 289 selection.add(n); 290 } 284 291 } 285 292 286 293 // ways 287 294 for (Way w : nc.getCurrentDataSet().ways) { 288 if (w.deleted || w.getNodesCount() == 0 || w.incomplete) 289 continue; 295 if (w.deleted || w.getNodesCount() == 0 || w.incomplete) { 296 continue; 297 } 290 298 if (alt) { 291 299 for (Node n : w.getNodes()) { … … 303 311 } 304 312 } 305 if (allIn) selection.add(w); 313 if (allIn) { 314 selection.add(w); 315 } 306 316 } 307 317 }
Note:
See TracChangeset
for help on using the changeset viewer.