Skip to content

Instantly share code, notes, and snippets.

View johnwhelchel's full-sized avatar

johnwhelchel johnwhelchel

View GitHub Profile
@shawnbot
shawnbot / README.md
Last active December 11, 2018 09:09
d3 bounded zoom behavior

This gist shows how to restrict d3's zoom behavior so that users can't pan outside of a rectangular bounding box. Use your scroll wheel to zoom in and out of the field of circles, and click and drag to move when zoomed in. Note how when you zoom back out (by scrolling up) the view snaps to the original extent at zoom 1.