Skip to content

Commit

Permalink
Bug fix: check whether sw and ne are equal when rendering list view d…
Browse files Browse the repository at this point in the history
…ots on map
  • Loading branch information
sfomuseumbot committed May 23, 2024
1 parent 647bbdf commit 6db07c7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion static/javascript/whosonfirst.spelunker.places.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,22 @@ window.addEventListener("load", function load(event){
map.setView([coords[0][1], coords[0][0]], 12);
break;
default:

// START OF wrap me in a common function

var bounds = whosonfirst.spelunker.geojson.derive_bounds(f);
map.fitBounds(bounds);
var sw = bounds[0];
var ne = bounds[1];

// TO DO: set zoom based on placetype or mz:min/max_zoom (requires fetching all the records so... maybe not?)
if ((sw[0] == ne[0]) && (sw[1] == ne[1])){
map.setView(sw, 12);
} else {
map.fitBounds(bounds);
}

// END OF wrap me in a common function

break;
}

Expand Down

0 comments on commit 6db07c7

Please sign in to comment.