mousewheel-zoom + click-to-center
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Mar 26, 2012
This example demonstrates interactive zooming and panning on a map of the United States using mousewheel events and click-to-center functionality. The visualization uses an Albers USA projection rendered as SVG paths, with state boundaries drawn from TopoJSON data loaded via `d3.json`. D3’s `d3.behavior.zoom` handles wheel zoom and drag panning, while a click on any state triggers a smooth 700-millisecond transition that recenters the projection on that state’s centroid. The `d3.geo.path` generator updates the path data during both zooming and click-driven transitions, and the code explicitly manages the projection’s translate and scale properties to synchronize with the zoom behavior.
AI-generated descriptionPart of a series of examples. See:
gpl-3.0 Licensed