Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java	(revision 25808)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java	(revision 25809)
@@ -6,4 +6,6 @@
 import java.awt.Graphics2D;
 import java.awt.Point;
+import java.awt.geom.Point2D;
+import java.awt.Rectangle;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -28,9 +30,12 @@
     private static final int DEFAULT_REFRESH_INTERVAL = 250;
     private static final int DEFAULT_CENTER_INTERVAL = 5000;
+    private static final int DEFAULT_CENTER_FACTOR = 80;
     private static final String oldC_REFRESH_INTERVAL = "livegps.refreshinterval";     /* in seconds */
     private static final String C_REFRESH_INTERVAL = "livegps.refresh_interval_msec";  /* in msec */
     private static final String C_CENTER_INTERVAL = "livegps.center_interval_msec";  /* in msec */
+    private static final String C_CENTER_FACTOR = "livegps.center_factor" /* in percent */;
     private int refreshInterval;
     private int centerInterval;
+    private double centerFactor;
     private long lastRedraw = 0;
     private long lastCenter = 0;
@@ -69,6 +74,6 @@
         lastPoint.attr.put("time", dateFormat.format(new Date()));
         trackSegment.addWaypoint(lastPoint);
-        if (autocenter && allowCenter())
-            center();
+
+	conditionalCenter(thisPos);
     }
 
@@ -76,4 +81,18 @@
         if (lastPoint != null)
             Main.map.mapView.zoomTo(lastPoint.getCoor());
+    }
+
+    public void conditionalCenter(LatLon Pos) {
+	Point2D P = Main.map.mapView.getPoint2D(Pos);
+	Rectangle rv = Main.map.mapView.getBounds(null);
+	Date date = new Date();
+	long current = date.getTime();
+
+	rv.grow(-(int)(rv.getHeight() * centerFactor), -(int)(rv.getWidth() * centerFactor));
+
+	if (!rv.contains(P) || (centerInterval > 0 && current - lastCenter >= centerInterval)) {
+		Main.map.mapView.zoomTo(Pos);
+		lastCenter = current;
+	}
     }
 
@@ -170,21 +189,4 @@
 
     /**
-     * Check, if a autocentering is currently allowed.
-     *
-     * @return true, if a autocentering is permitted, false, if a autocentering
-     * should be suppressed.
-     */
-    private boolean allowCenter() {
-	Date date = new Date();
-	long current = date.getTime();
-
-	if (current - lastCenter >= centerInterval) {
-		lastCenter = current;
-		return true;
-	} else
-		return false;
-    }
-
-    /**
      * Retrieve the refreshInterval and centerInterval from the configuration. Be compatible
      * with old version that stored refreshInterval in seconds. If no such configuration key
@@ -192,17 +194,26 @@
      */
     private void initIntervals() {
-        if ((refreshInterval = Main.pref.getInteger(C_REFRESH_INTERVAL, 0)) == 0) {
-                if ((refreshInterval = Main.pref.getInteger(oldC_REFRESH_INTERVAL, 0)) != 0) {
-                        refreshInterval *= 1000;
-                        Main.pref.put(oldC_REFRESH_INTERVAL, null);
-                } else
-                        refreshInterval = DEFAULT_REFRESH_INTERVAL;
-        }
-
-	if ((centerInterval = Main.pref.getInteger(C_CENTER_INTERVAL, 0)) == 0)
-		centerInterval = DEFAULT_CENTER_INTERVAL;
+	if ((refreshInterval = Main.pref.getInteger(oldC_REFRESH_INTERVAL, 0)) != 0) {
+		refreshInterval *= 1000;
+		Main.pref.put(oldC_REFRESH_INTERVAL, null);
+	} else
+		refreshInterval = Main.pref.getInteger(C_REFRESH_INTERVAL, DEFAULT_REFRESH_INTERVAL);
+
+	centerInterval = Main.pref.getInteger(C_CENTER_INTERVAL, DEFAULT_CENTER_INTERVAL);
+	centerFactor = Main.pref.getInteger(C_CENTER_FACTOR, DEFAULT_CENTER_FACTOR);
+	if (centerFactor <= 1 || centerFactor >= 99)
+		centerFactor = DEFAULT_CENTER_FACTOR;
 
         Main.pref.putInteger(C_REFRESH_INTERVAL, refreshInterval);
         Main.pref.putInteger(C_CENTER_INTERVAL, centerInterval);
+	Main.pref.putInteger(C_CENTER_FACTOR, (int )centerFactor);
+
+	/*
+	 * Do one time conversion of factor: user value means "how big is inner rectangle
+	 * comparing to screen in percent", machine value means "what is the shrink ratio
+	 * for each dimension on _both_ sides".
+	 */
+
+	centerFactor = (100 - centerFactor) / 2 / 100;
     }
 }
