Skip to content

Commit

Permalink
Don't query prefs on every draw
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Jan 2, 2025
1 parent 666783a commit 9de0896
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/de/blau/android/layer/data/MapOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public class MapOverlay<O extends OsmElement> extends MapViewLayer
private int autoDownloadBoxLimit = DEFAULT_DOWNLOADBOX_LIMIT;
private int panAndZoomLimit = PAN_AND_ZOOM_LIMIT;

private boolean wayNodeDragging;

private final StorageDelegator delegator;
private final Context context;
private final Validator validator;
Expand Down Expand Up @@ -1474,7 +1476,7 @@ private void paintWay(@NonNull final Canvas canvas, @NonNull final Way way, fina
labelFontStyle = labelTextStyleNormalSelected;
labelFontStyleSmall = labelTextStyleSmallSelected;
// visual feedback if way nodes are draggable
if (prefs.isWayNodeDraggingEnabled() && context instanceof Main && ((Main) context).getEasyEditManager().inWaySelectedMode()) {
if (wayNodeDragging && context instanceof Main && ((Main) context).getEasyEditManager().inWaySelectedMode()) {
for (int i = 0; i < pointsSize; i += 4) {
canvas.drawCircle(linePoints[i], linePoints[i + 1], nodeToleranceRadius, nodeDragRadiusPaint);
}
Expand Down Expand Up @@ -1755,6 +1757,7 @@ public void setPrefs(@NonNull final Preferences prefs) {
autoPruneNodeLimit = prefs.getAutoPruneNodeLimit();
autoDownloadBoxLimit = prefs.getAutoPruneBoundingBoxLimit();
panAndZoomLimit = prefs.getPanAndZoomLimit();
wayNodeDragging = prefs.isWayNodeDraggingEnabled();
iconCache.clear();
areaIconCache.clear();
}
Expand Down

0 comments on commit 9de0896

Please sign in to comment.