Changeset 2348 in josm for trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
- Timestamp:
- 2009-10-29T19:45:49+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r2310 r2348 499 499 } 500 500 } 501 DataSet.fireSelectionChanged(selection);501 getCurrentDataSet().fireSelectionChanged(); 502 502 } 503 503 } … … 515 515 public void selectPrims(Collection<OsmPrimitive> selectionList, boolean shift, 516 516 boolean ctrl, boolean released, boolean area) { 517 DataSet ds = getCurrentDataSet(); 517 518 if ((shift && ctrl) || (ctrl && !released)) 518 519 return; // not allowed together 519 520 520 Collection<OsmPrimitive> curSel; 521 if (!ctrl && !shift) { 522 curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old. 521 // plain clicks with no modifiers clear the selection 522 if (!ctrl && !shift) 523 ds.clearSelection(); 524 525 if (ctrl) { 526 // Ctrl on an item toggles its selection status, 527 // but Ctrl on an *area* just clears those items 528 // out of the selection. 529 if (area) 530 ds.clearSelection(selectionList); 531 else 532 ds.toggleSelected(selectionList); 523 533 } else { 524 curSel = getCurrentDataSet().getSelected(); 525 } 526 527 for (OsmPrimitive osm : selectionList) 528 { 529 if (ctrl) 530 { 531 if(curSel.contains(osm)) { 532 curSel.remove(osm); 533 } else if(!area) { 534 curSel.add(osm); 535 } 536 } else { 537 curSel.add(osm); 538 } 539 } 540 getCurrentDataSet().setSelected(curSel); 534 // This is either a plain click (which means we 535 // previously cleared the selection), or a 536 // shift-click where we are adding things to an 537 // existing selection. 538 ds.addSelected(selectionList); 539 } 540 ds.fireSelectionChanged(); 541 541 Main.map.mapView.repaint(); 542 542 }
Note:
See TracChangeset
for help on using the changeset viewer.