selectCountries = {
let [x0, y0] = projection(selectedBbox.slice(0, 2));
let [x1, y1] = projection(selectedBbox.slice(2, 4));
let dx = x1 - x0,
dy = y0 - y1,
x = (x0 + x1) / 2,
y = (y0 + y1) / 2,
scale = Math.min(width / dx, height / dy, 10),
[tx, ty] = [width / 2 - scale * x, height / 2 - scale * y];
countriesSvg
.selectAll(".region")
.attr("fill", d => (selectedIds.has(d.id) ? "#555" : "#eee"));
countriesSvg
.select(".mainGroup")
.transition()
.duration(750)
.attr("transform", `translate(${tx},${ty}) scale(${scale})`)
.attr("stroke-width", `${1 / scale}`);
}