diff options
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CachesOverlay.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index ad455b5..8fbb3db 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -122,6 +122,8 @@ public class CachesOverlay extends AbstractItemizedOverlay { try { lazyInitializeDrawingObjects(); canvas.setDrawFilter(setFilter); + final int height = canvas.getHeight(); + final int width = canvas.getWidth(); final int radius = calculateDrawingRadius(projection); final Point center = new Point(); @@ -131,16 +133,17 @@ public class CachesOverlay extends AbstractItemizedOverlay { final Geopoint itemCoord = item.getCoord().getCoords(); final GeoPointImpl itemGeo = mapItemFactory.getGeoPointBase(itemCoord); projection.toPixels(itemGeo, center); - - // dashed circle around the waypoint - blockedCircle.setColor(0x66BB0000); - blockedCircle.setStyle(Style.STROKE); - canvas.drawCircle(center.x, center.y, radius, blockedCircle); - - // filling the circle area with a transparent color - blockedCircle.setColor(0x44BB0000); - blockedCircle.setStyle(Style.FILL); - canvas.drawCircle(center.x, center.y, radius, blockedCircle); + if (center.x > -radius && center.y > -radius && center.x < width + radius && center.y < height + radius) { + // dashed circle around the waypoint + blockedCircle.setColor(0x66BB0000); + blockedCircle.setStyle(Style.STROKE); + canvas.drawCircle(center.x, center.y, radius, blockedCircle); + + // filling the circle area with a transparent color + blockedCircle.setColor(0x44BB0000); + blockedCircle.setStyle(Style.FILL); + canvas.drawCircle(center.x, center.y, radius, blockedCircle); + } } } canvas.setDrawFilter(removeFilter); |
