docs: Document altosui "Graph Data" button
[fw/altos] / ao-tools / altosui / AltosSiteMap.java
index 2477e4f85d462dffa9d23a5b871cd542dde55c27..d4a4cbf43dbaa66b7c0c69ca6da2be09bef08e5c 100644 (file)
@@ -230,16 +230,19 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                // if insufficient gps data, nothing to update
                if (state.gps == null)
                        return;
-               if (state.pad_lat == 0 && state.pad_lon == 0)
+               if (!state.gps.locked && state.gps.nsat < 4)
                        return;
-               if (!state.gps.locked) {
-                       if (state.gps.nsat < 4)
-                               return;
-               }
 
                if (!initialised) {
-                       initMaps(state.pad_lat, state.pad_lon);
-                       initialised = true;
+                       if (state.pad_lat != 0 || state.pad_lon != 0) {
+                               initMaps(state.pad_lat, state.pad_lon);
+                               initialised = true;
+                       } else if (state.gps.lat != 0 || state.gps.lon != 0) {
+                               initMaps(state.gps.lat, state.gps.lon);
+                               initialised = true;
+                       } else {
+                               return;
+                       }
                }
 
                final Point2D.Double pt = pt(state.gps.lat, state.gps.lon);
@@ -317,7 +320,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                Point2D.Double copt = translatePoint(pt, tileCoordOffset(topleft));
                int dx = (int)copt.x - r.width/2 - r.x;
                int dy = (int)copt.y - r.height/2 - r.y;
-               if (Math.abs(dx) > r.width/3 || Math.abs(dy) > r.height/3) {
+               if (Math.abs(dx) > r.width/4 || Math.abs(dy) > r.height/4) {
                        r.x += dx;
                        r.y += dy;
                        comp.scrollRectToVisible(r);