Open burritojustice opened 7 years ago
tried implementingfitbounds
in #34 but rolled it back as it seemed to be conflicting with the lat/lon hash
how about this: if there are three numbers in the hash, assume /zoom/lat/lon
, but if there are four numbers in the hash, assume /swLat/swLon/neLat/neLon
for fitbounds
?
Assuming that a fourth number implies totally different functionality could be confusing – but I think following the maxbounds
convention could work, and be more transparent.
A counterproposal which seems to be working pretty well: how about a fitbounds
parameter which, if included, runs map.fitBounds()
with any included maxBounds
parameter definition?
Still can't see that in precog (🐴)) but this seems like a reasonable first step -- though would this also enforce maxBounds
?
There's a difference between locking a users within an area, and setting an initial view that they can use as a starting point... (My initial concern with implementing fitbounds
was that it was arguing with the URL hash.)
leverage Leaflet's
fitBounds
so we can show a map of a predetermined area without having to worry about screen size (and leverage bounding boxes).While we could pass two parameters:
https://tangrams.github.io/tangram-frame/?url=.../sw=40.712, -74.227/ne=40.774,-74125
maybe one is better?
https://tangrams.github.io/tangram-frame/?url=.../bbox=40.712, -74.227,40.774,-74125
that's SW lat/lon, NE lat/lon, as per leaflet
fitbounds
http://leafletjs.com/reference.html#map-fitbounds