Question about Synchronized Views notebook

I’ve really enjoyed the recent notebooks and discussion on mutable and viewof. However, I think I’m still missing something key. For instance, in this one, how is view.value actually getting updated? I see the view.value = view.value line, and see how that dispatches an input event, but I don’t understand how that line updates polygon.value, allowing all the polygons to redraw the path.

The D3 selection called point has .data(view.value). That means in the dragged callback when you set d[0] = d3.event.x, the d[0] is another name for view.value[i][0]. That is, the view.value object is getting mutated in place, and then the view.value = view.value line just makes sure that the update gets noticed, by dispatching an event.

You may want to look at the documentation for d3.drag to figure out how to data flows through this code.

Thanks @jrus. That makes sense.