Ticket #6764: dilemma_fix.patch
File dilemma_fix.patch, 3.7 KB (added by , 13 years ago) |
---|
-
src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
273 273 private boolean giveUserFeedback(MouseEvent e, int modifiers) { 274 274 boolean needsRepaint = false; 275 275 276 // the target highlight will always be wrong, regardless if already selected values 277 // are preferred or not. The reason for this is that in when moving primitives they 278 // need to, otherwise it's hard to move the selection (#6334). However, when in select 279 // mode this makes it hard to select primitives close to each other (#6764). Deciding 280 // if a move or selection occurs can only be done after the mouse button has been 281 // released so it's impossible to always get the highlighting right. It's currently set 282 // to highlight the other primitive, but use the selected on move. 276 283 Collection<OsmPrimitive> c = MapView.asColl( 277 mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true));284 mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, false)); 278 285 279 286 updateKeyModifiers(modifiers); 280 287 determineMapMode(!c.isEmpty()); … … 664 671 mouseDownTime = System.currentTimeMillis(); 665 672 lastMousePos = e.getPoint(); 666 673 674 // this is used for most actions but may be overwritten on mouse release in order 675 // to cycle through close primitives. Note that already selected primitives need 676 // to be preferred, otherwise it gets hard to move the selection (see #6334). 677 // Compare to the large comment in giveUserFeedback if you change this. 667 678 Collection<OsmPrimitive> c = MapView.asColl( 668 679 mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true)); 680 System.out.println("--"); 681 System.out.println(mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, false)); 682 System.out.println(mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true)); 669 683 670 684 determineMapMode(!c.isEmpty()); 671 685 switch(mode) { … … 684 698 if (!cancelDrawMode && c.iterator().next() instanceof Way) { 685 699 setupVirtual(e); 686 700 } 687 688 selectPrims(cycleSetup(c, e), e, false, false); 701 selectPrims(c, e, false, false); 689 702 break; 690 703 case select: 691 704 default: … … 722 735 virtualNode = null; 723 736 724 737 // do nothing if the click was to short too be recognized as a drag, 725 // but the release position is farther than 10px away from the press position 738 // but the release position is farther than 10px away from the press position. 739 // if it's within that radius, so some selection magic: 726 740 if (lastMousePos == null || lastMousePos.distanceSq(e.getPoint()) < 100) { 741 // do NOT prefer already selected primitives here. Otherwise it gets very hard to 742 // select primitives that are close to each other (see #6764). Compare to the large 743 // comment in giveUserFeedback if you change this. 744 Collection<OsmPrimitive> single = MapView.asColl( 745 mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, false)); 746 cycleSetup(single, e); 727 747 selectPrims(cyclePrims(cycleList, e), e, true, false); 728 748 729 749 // If the user double-clicked a node, change to draw mode