I’m really not good in javascript but I’m trying to port Brush & Zoom II from bl.ocks to observablehq (my attempt) as to learn about brush and zoom.
The problem is that I don’t get quite get all the original code although I made progress since this morning (about 7 hours ago) and some doc reading (w3, d3, moz://a).
The main change that I made was to move some of the code into the svg cell. Note that each cell defines its own function scope, so the only variables defined in a cell that you can access from other cells are the ones that you output with a return or yield statement.