Skip to main content
100%

Drag Multiples

✓ Published0🌍 Public
AAjayyy
Last edited Jun 17, 2019
Created on Jun 17, 2019

Sixteen small SVG canvases each contain a single draggable circle, centered by default. The example uses `d3.behavior.drag` with an `origin(Object)` accessor and a `dragmove` handler to reposition circles within each square's bounds. `d3.select` and `d3.attr` update the circle's `cx` and `cy` coordinates, clamped to keep the circle inside the 238×123 pixel viewport. The code generates the multiple SVGs via `d3.range(16).map()`, with each circle sharing identical initial coordinates, allowing independent dragging across all instances.

AI-generated description

forked from <a href='http://bl.ocks.org/GerHobbelt/'>GerHobbelt</a>'s block: <a href='http://bl.ocks.org/GerHobbelt/3125020'>Drag Multiples</a>

mit Licensed

Similar vizzes