how prevent event with referred mutable variable in drag event?

i want to drag to circle
tried to code this

but the position is not intended.

I think mutable variable emit event in global scope. (read this Use mutability to draw draggable globe on canvas? )

can you explain this, please?

Your approach isn’t working because when you reassign mutable data in update, your SVG element is recreated (because that cell references data), which somehow confuses the apparent coordinates of the pointer.

If you want to drag circles in SVG, I recommend this approach:

There are a variety of other examples of d3.drag here:

Thanks, Mike.
but can I use mutable data in update?
I want to see to changing position values like in circles cell by dragging circle.

i think that best way was using mutable before.

Is there nothing way to except to use to viewof ?


@shallwefootball Just in case you’re trying to create a 2D range slider, there’s one at

(with another example in