Ignore:
Timestamp:
2006-01-21T19:02:06+01:00 (18 years ago)
Author:
imi
Message:

fixed fancy download world chooser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/SelectionManager.java

    r30 r42  
    8989        private Point mousePos;
    9090        /**
    91          * The MapView, the selection rectangle is drawn onto.
    92          */
    93         private final MapView mv;
     91         * The Component, the selection rectangle is drawn onto.
     92         */
     93        private final NavigatableComponent nc;
    9494        /**
    9595         * Whether the selection rectangle must obtain the aspect ratio of the
     
    105105         * @param aspectRatio If true, the selection window must obtain the aspect
    106106         *              ratio of the drawComponent.
    107          * @param mapView The view, the rectangle is drawn onto.
    108          */
    109         public SelectionManager(SelectionEnded selectionEndedListener, boolean aspectRatio, MapView mapView) {
     107         * @param navComp The component, the rectangle is drawn onto.
     108         */
     109        public SelectionManager(SelectionEnded selectionEndedListener, boolean aspectRatio, NavigatableComponent navComp) {
    110110                this.selectionEndedListener = selectionEndedListener;
    111111                this.aspectRatio = aspectRatio;
    112                 this.mv = mapView;
     112                this.nc = navComp;
    113113        }
    114114       
     
    196196                if (mousePos == null || mousePosStart == null || mousePos == mousePosStart)
    197197                        return;
    198                 Graphics g = mv.getGraphics();
     198                Graphics g = nc.getGraphics();
    199199                g.setColor(Color.BLACK);
    200200                g.setXORMode(Color.WHITE);
     
    224224                if (aspectRatio) {
    225225                        // keep the aspect ration by shrinking the rectangle
    226                         double aspectRatio = (double)mv.getWidth()/mv.getHeight();
     226                        double aspectRatio = (double)nc.getWidth()/nc.getHeight();
    227227                        if ((double)w/h > aspectRatio) {
    228228                                int neww = (int)(h*aspectRatio);
     
    267267
    268268                if (clicked) {
    269                         OsmPrimitive osm = mv.getNearest(center, alt);
     269                        OsmPrimitive osm = nc.getNearest(center, alt);
    270270                        if (osm != null)
    271271                                selection.add(osm);
     
    273273                        // nodes
    274274                        for (Node n : Main.main.ds.nodes) {
    275                                 if (r.contains(mv.getScreenPoint(n.coor)))
     275                                if (r.contains(nc.getScreenPoint(n.coor)))
    276276                                        selection.add(n);
    277277                        }
     
    310310        private boolean rectangleContainLineSegment(Rectangle r, boolean alt, LineSegment ls) {
    311311                if (alt) {
    312                         Point p1 = mv.getScreenPoint(ls.start.coor);
    313                         Point p2 = mv.getScreenPoint(ls.end.coor);
     312                        Point p1 = nc.getScreenPoint(ls.start.coor);
     313                        Point p2 = nc.getScreenPoint(ls.end.coor);
    314314                        if (r.intersectsLine(p1.x, p1.y, p2.x, p2.y))
    315315                                return true;
    316316                } else {
    317                         if (r.contains(mv.getScreenPoint(ls.start.coor))
    318                                         && r.contains(mv.getScreenPoint(ls.end.coor)))
     317                        if (r.contains(nc.getScreenPoint(ls.start.coor))
     318                                        && r.contains(nc.getScreenPoint(ls.end.coor)))
    319319                                return true;
    320320                }
Note: See TracChangeset for help on using the changeset viewer.