block by hollasch 12e6627b4a8d7c3ceaac5297fa1d3169

World Map with Zoom and Continuous Horizontal Pan

Full Screen

This gist illustrates a world map with zoom and continuous (infinite) horizontal panning. Dragging left/right rotates the projection cylinder, and dragging up/down translates the projection accordingly (clamped by latitude bounds).

The viewbox is the full width of the page.

This example still has an annoying issue with zooms. In my ideal world, the map should zoom centered on the cursor location. Unfortunately, the map just changes scale centered on the equator and the longitude at the center of the viewport. I haven’t yet been able to find a way to make this work (using D3 v3).

Source

This example is based on Patrick Surry‘s example Rolling pan and zoom with Mercator projection.

index.html