Skip to content

Commit

Permalink
preserve text labels when compacting small features
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Oct 1, 2023
1 parent d51aa71 commit c570fe0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/GeoJsonNoVanish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class GeoJsonNoVanish extends L.GeoJSON {
const d = Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
if (d > Math.pow(this.threshold, 2) || is_max_zoom) {
delete o.obj.placeholder;
this.addLayer(o.obj);
this.removeLayer(o);
o.obj.bindTooltip(o._tooltip);
this.addLayer(o.obj);
}
return;
}
Expand All @@ -61,12 +62,13 @@ class GeoJsonNoVanish extends L.GeoJSON {
c.on("click", function (e) {
this.obj.fireEvent(e.type, e);
});
this.removeLayer(o);
this.resetStyle(c);
c.options.interactive = true;
c.options.stroke = true;
c.options.fill = true;
c.bindTooltip(o._tooltip);
this.addLayer(c);
this.removeLayer(o);
}, this);
}
}
Expand Down

0 comments on commit c570fe0

Please sign in to comment.