Changeset 2009 in josm for trunk/src/org


Ignore:
Timestamp:
2009-08-30T15:57:46+02:00 (15 years ago)
Author:
Gubaer
Message:

applied #2595: patch by plaicy: Draw Mode: Click-to-Select fails under certain conditions
clean up for @deprecated OptionPaneUtil

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r1935 r2009  
    5151import org.openstreetmap.josm.gui.MapFrame;
    5252import org.openstreetmap.josm.gui.MapView;
    53 import org.openstreetmap.josm.gui.OptionPaneUtil;
    5453import org.openstreetmap.josm.gui.layer.Layer;
    5554import org.openstreetmap.josm.gui.layer.MapViewPaintable;
     
    136135                        default:
    137136                            Main.map.mapView.setCursor(cursorCrosshair);
    138                         break;
     137                            break;
    139138                    }
    140139                }
     
    340339        if (n != null) {
    341340            // user clicked on node
    342             if (selection.isEmpty()) {
     341            if (selection.isEmpty() || wayIsFinished) {
    343342                // select the clicked node and do nothing else
    344343                // (this is just a convenience option so that people don't
     
    355354            n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY()));
    356355            if (n.getCoor().isOutSideWorld()) {
    357                 OptionPaneUtil.showMessageDialog(
     356                JOptionPane.showMessageDialog(
    358357                        Main.parent,
    359358                        tr("Cannot add a node outside of the world."),
     
    855854            default:
    856855                EastNorth P = n.getEastNorth();
    857             seg = segs.iterator().next();
    858             A = seg.a.getEastNorth();
    859             B = seg.b.getEastNorth();
    860             double a = P.distanceSq(B);
    861             double b = P.distanceSq(A);
    862             double c = A.distanceSq(B);
    863             q = (a - b + c) / (2*c);
    864             n.setEastNorth(new EastNorth(B.east() + q * (A.east() - B.east()), B.north() + q * (A.north() - B.north())));
     856                seg = segs.iterator().next();
     857                A = seg.a.getEastNorth();
     858                B = seg.b.getEastNorth();
     859                double a = P.distanceSq(B);
     860                double b = P.distanceSq(A);
     861                double c = A.distanceSq(B);
     862                q = (a - b + c) / (2*c);
     863                n.setEastNorth(new EastNorth(B.east() + q * (A.east() - B.east()), B.north() + q * (A.north() - B.north())));
    865864        }
    866865    }
Note: See TracChangeset for help on using the changeset viewer.