Skip to content

Commit 3573151

Browse files
committed
Dynamic zoom with a minimum.
1 parent dd05a33 commit 3573151

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

assets/js/leaflet_functions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ function create_district_map(id, bounds, options) {
336336
legend_breaks: ['0%', '5%', '10%', '15%+'],
337337
legend_title: 'Estimated<br/>HIV Prevalence',
338338
pop_cutoff_low: 50,
339-
pop_cutoff_high: 200
339+
pop_cutoff_high: 200,
340+
zoom_min: 10
340341
};
341342
options = {...default_options, ...options};
342343

@@ -356,6 +357,9 @@ function create_district_map(id, bounds, options) {
356357
}
357358
}).addTo(map);
358359
map.fitBounds(district_layer.getBounds());
360+
if(map.getZoom() < options.zoom_min){
361+
map.setView(map.getCenter(), options.zoom_min);
362+
}
359363

360364
// Create all toggleable layers
361365
var base_layers = {};

0 commit comments

Comments
 (0)