Ticket #18204: 18204.patch
| File 18204.patch, 2.6 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/NavigatableComponent.java
103 103 104 104 /** Snap distance */ 105 105 public static final IntegerProperty PROP_SNAP_DISTANCE = new IntegerProperty("mappaint.node.snap-distance", 10); 106 /** Snap distance for way segments */ 107 public static final IntegerProperty PROP_SEGMENT_SNAP_DISTANCE = new IntegerProperty("mappaint.segment.snap-distance", 10); 106 108 /** Zoom steps to get double scale */ 107 109 public static final DoubleProperty PROP_ZOOM_RATIO = new DoubleProperty("zoom.ratio", 2.0); 108 110 /** Divide intervals between native resolution levels to smaller steps if they are much larger than zoom ratio */ … … 938 940 DataSet ds = MainApplication.getLayerManager().getActiveDataSet(); 939 941 940 942 if (ds != null) { 941 double dist, snapDistanceSq = PROP_SNAP_DISTANCE.get(); 942 snapDistanceSq *= snapDistanceSq; 943 int snapDistance = PROP_SNAP_DISTANCE.get(); 944 double dist, snapDistanceSq; 945 if (snapDistance > getState().getViewHeight() || snapDistance > getState().getViewWidth()) { 946 Logging.error(PROP_SNAP_DISTANCE.getKey() + " used with zero height or width in view " + getState()); 947 } 948 snapDistanceSq = (double) snapDistance * snapDistance; 943 949 944 950 for (Node n : ds.searchNodes(getBBox(p, PROP_SNAP_DISTANCE.get()))) { 945 951 if (predicate.test(n) … … 1147 1153 DataSet ds = MainApplication.getLayerManager().getActiveDataSet(); 1148 1154 1149 1155 if (ds != null) { 1150 double snapDistanceSq = Config.getPref().getInt("mappaint.segment.snap-distance", 10); 1151 snapDistanceSq *= snapDistanceSq; 1156 int snapDistance = PROP_SEGMENT_SNAP_DISTANCE.get(); 1157 if (snapDistance >= getState().getViewHeight() || snapDistance >= getState().getViewWidth()) { 1158 Logging.error(PROP_SEGMENT_SNAP_DISTANCE.getKey() + " used with zero height or width in view " + getState()); 1159 } 1160 double snapDistanceSq = (double) snapDistance * snapDistance; 1152 1161 1153 for (Way w : ds.searchWays(getBBox(p, Config.getPref().getInt("mappaint.segment.snap-distance", 10)))) {1162 for (Way w : ds.searchWays(getBBox(p, snapDistance))) { 1154 1163 if (!predicate.test(w)) { 1155 1164 continue; 1156 1165 }
