Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions datasette_cluster_map/static/datasette-cluster-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ const addClusterMap = (latitudeColumn, longitudeColumn) => {
let el = document.createElement("div");
el.style.width = "100%";
el.style.height = "500px";
el.style.resize = "vertical";
let tiles = L.tileLayer(
window.DATASETTE_CLUSTER_MAP_TILE_LAYER,
window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS
Expand All @@ -286,6 +287,9 @@ const addClusterMap = (latitudeColumn, longitudeColumn) => {
zoom: 13,
layers: [tiles],
});
new ResizeObserver(() => {
map.invalidateSize();
}).observe(el);
const container = window.DATASETTE_CLUSTER_MAP_CONTAINER;
if (container && document.querySelector(container)) {
document.querySelector(container).appendChild(el);
Expand Down