Renders a single US state, using d3-zoom to fit the container, and to allow zooming and panning.
The desired behavior is to constrain panning to the bounds of the state. The TopoJSON is projected to 600x600, and at that container size, the zoom & pan works great. However, at smaller container sizes, where the map has been scaled, the panning is jumpy/broken. I've tried setting different values for translateExtent
, but I don't realy understand how it's supposed to work.
One notable thing is that I'm using a null projection for d3.geoPath
, because I used ogr2ogr
to generate a shapefile in projected coordinates for each state. That's why I used a zoom transform to fit the map to its container.
References on bl.ocks.org: