Changeset 7389 in josm for trunk/src


Ignore:
Timestamp:
2014-08-13T23:07:06+02:00 (5 years ago)
Author:
bastiK
Message:

see #10363 - you cannot click on object that is not visible on the map

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r7218 r7389  
    233233    private boolean giveUserFeedback(MouseEvent e, int modifiers) {
    234234        Collection<OsmPrimitive> c = asColl(
    235                 mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true));
     235                mv.getNearestNodeOrWay(e.getPoint(), mv.isSelectablePredicate, true));
    236236
    237237        updateKeyModifiers(modifiers);
     
    406406        // primitives under cursor are stored in c collection
    407407
    408         OsmPrimitive nearestPrimitive = mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, true);
     408        OsmPrimitive nearestPrimitive = mv.getNearestNodeOrWay(e.getPoint(), mv.isSelectablePredicate, true);
    409409
    410410        determineMapMode(nearestPrimitive!=null);
     
    687687        Collection<OsmPrimitive> selection = getCurrentDataSet().getSelectedNodesAndWays();
    688688        if (selection.isEmpty()) { // if nothing was selected to drag, just select nearest node/way to the cursor
    689             OsmPrimitive nearestPrimitive = mv.getNearestNodeOrWay(mv.getPoint(startEN), OsmPrimitive.isSelectablePredicate, true);
     689            OsmPrimitive nearestPrimitive = mv.getNearestNodeOrWay(mv.getPoint(startEN), mv.isSelectablePredicate, true);
    690690            getCurrentDataSet().setSelected(nearestPrimitive);
    691691        }
     
    858858        Collection<Node> target = mv.getNearestNodes(p,
    859859                getCurrentDataSet().getSelectedNodes(),
    860                 OsmPrimitive.isSelectablePredicate);
     860                mv.isSelectablePredicate);
    861861        return target.isEmpty() ? null : target.iterator().next();
    862862    }
     
    964964                    if (waitForMouseUpParameter) {
    965965                        // prefer a selected nearest node or way, if possible
    966                         osm = mv.getNearestNodeOrWay(p, OsmPrimitive.isSelectablePredicate, true);
     966                        osm = mv.getNearestNodeOrWay(p, mv.isSelectablePredicate, true);
    967967                    }
    968968                } else {
    969969                    // Alt + left mouse button pressed: we need to build cycle list
    970                     cycleList = mv.getAllNearest(p, OsmPrimitive.isSelectablePredicate);
     970                    cycleList = mv.getAllNearest(p, mv.isSelectablePredicate);
    971971
    972972                    if (cycleList.size() > 1) {
     
    11041104
    11051105                Way w = null;
    1106                 for (WaySegment ws : mv.getNearestWaySegments(p, OsmPrimitive.isSelectablePredicate)) {
     1106                for (WaySegment ws : mv.getNearestWaySegments(p, mv.isSelectablePredicate)) {
    11071107                    w = ws.way;
    11081108
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r7135 r7389  
    4848import org.openstreetmap.josm.gui.download.DownloadDialog;
    4949import org.openstreetmap.josm.gui.help.Helpful;
     50import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    5051import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    5152import org.openstreetmap.josm.tools.Predicate;
     
    8384        void systemOfMeasurementChanged(String oldSoM, String newSoM);
    8485    }
     86
     87    public Predicate<OsmPrimitive> isSelectablePredicate = new Predicate<OsmPrimitive>() {
     88        @Override
     89        public boolean evaluate(OsmPrimitive prim) {
     90            if (!prim.isSelectable()) return false;
     91            // if it isn't displayed on screen, you cannot click on it
     92            return !MapPaintStyles.getStyles().get(prim, getDist100Pixel(), NavigatableComponent.this).isEmpty();
     93        }
     94    };
    8595
    8696    public static final IntegerProperty PROP_SNAP_DISTANCE = new IntegerProperty("mappaint.node.snap-distance", 10);
Note: See TracChangeset for help on using the changeset viewer.