block by SpaceActuary 2405b9a0e192fb268d95683421cbbdd2

Drag & Zoom II

Full Screen

This example shows how to combine d3-drag and d3-zoom to allow dragging of individual circles within a zoomable SVG. If you click and drag on the background, the view pans; if you click and drag on a circle, it moves.

This is quite a bit simpler than implementing drag-and-zoom with Canvas, since the SVG element automatically provides hit-testing, coordinate system transformation and re-rendering.

forked from mbostock‘s block: Drag & Zoom II

index.html