From 21c3c9c1bd915e72a3b98d58ecb11aa19ec49433 Mon Sep 17 00:00:00 2001 From: luckyt Date: Sat, 2 Aug 2014 17:04:01 -0400 Subject: [PATCH] fixing bug on some devices caused by drawing a line from point to itself --- .../WATisRain/src/com/lucky/watisrain/MainActivity.java | 2 +- workspace/WATisRain/src/com/lucky/watisrain/map/MapDraw.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/workspace/WATisRain/src/com/lucky/watisrain/MainActivity.java b/workspace/WATisRain/src/com/lucky/watisrain/MainActivity.java index 07d9956..6419e67 100644 --- a/workspace/WATisRain/src/com/lucky/watisrain/MainActivity.java +++ b/workspace/WATisRain/src/com/lucky/watisrain/MainActivity.java @@ -51,7 +51,7 @@ protected void onStart(){ super.onStart(); // Make the zoom reasonable - attacher.setScale(1.6f, 2312f, 680f, true); + attacher.setScale(1.6f, 2312f, 400f, true); } diff --git a/workspace/WATisRain/src/com/lucky/watisrain/map/MapDraw.java b/workspace/WATisRain/src/com/lucky/watisrain/map/MapDraw.java index af395ac..39475e0 100644 --- a/workspace/WATisRain/src/com/lucky/watisrain/map/MapDraw.java +++ b/workspace/WATisRain/src/com/lucky/watisrain/map/MapDraw.java @@ -79,6 +79,11 @@ public void drawCircleOnMap(float x, float y, float radius, Paint paint){ */ public void drawLineOnMap(float x1, float y1, float x2, float y2, float linewidth, Paint paint){ + // Don't draw a line from a point to itself. Doing so causes a + // problem on some devices. + if(x1 == x2 && y1 == y2) + return; + float adjust_x1 = x1 * scale - offset_x; float adjust_y1 = y1 * scale - offset_y; float adjust_x2 = x2 * scale - offset_x;