{
let selection = [];
let brush = d3.brush()
.on("brush", brushed);
stage.append("g")
.call(brush)
.call(brush.move, [[width/4, height/4], [width/2, height/2]]);
function brushed() {
let extent = d3.event.selection;
for (let item of selection) {
d3.select(`#id${item.value}`)
.style("fill","darkblue")
}
let t1 = performance.now();
let resp = planarSetQuery(extent[0][0], extent[0][1], extent[1][0], extent[1][1]);
let t2 = performance.now();
mutable elapsed_time = t2 - t1;
selection = [];
for (let item of resp) {
d3.select(`#id${item.value}`)
.style("fill","red")
selection.push(item);
}
}
}