score:0

Accepted answer

I fixed it enforcing the translateExtent manually.

var scale = Math.max(1, Math.min(this._maxZoom, 1 / Math.max(width / zoomArea.width, height / zoomArea.height))),

translate = [
    Math.min(zoomArea.x, Math.max(zoomArea.width / 2 - scale * x, zoomArea.width - zoomArea.width * scale)),
    Math.min(zoomArea.y, Math.max(zoomArea.height / 2 - scale * y, zoomArea.height - zoomArea.height * scale))
];

score:0

From the docs https://github.com/d3/d3-zoom#zoom_transform

This method requires that you specify the new zoom transform completely, and does not enforce the defined scale extent and translate extent, if any


Related Query

More Query from same tag