Changeset boundary is enlarged if it was on a single point
authorJ Guthrie <jamie.guthrie@gmail.com>
Tue, 2 Oct 2018 22:56:42 +0000 (23:56 +0100)
committerJ Guthrie <jamie.guthrie@gmail.com>
Tue, 2 Oct 2018 22:56:42 +0000 (23:56 +0100)
app/assets/javascripts/index/history.js

index d54928e..71a94ae 100644 (file)
@@ -97,9 +97,17 @@ OSM.History = function(map) {
     $("[data-changeset]").each(function () {
       var changeset = $(this).data('changeset');
       if (changeset.bbox) {
+        var latModifier = 0;
+        var lonModifier = 0;
+
+        if (changeset.bbox.minlat === changeset.bbox.maxlat || changeset.bbox.minlon === changeset.bbox.maxlon) {
+          latModifier = 0.0001;
+          lonModifier = 0.0002;
+        }
+
         changeset.bounds = L.latLngBounds(
-          [changeset.bbox.minlat, changeset.bbox.minlon],
-          [changeset.bbox.maxlat, changeset.bbox.maxlon]);
+          [changeset.bbox.minlat - latModifier, changeset.bbox.minlon - lonModifier],
+          [changeset.bbox.maxlat + latModifier, changeset.bbox.maxlon + lonModifier]);
         changesets.push(changeset);
       }
     });