in src/components/ZoomableSVGGroup.js [261:286]
zoomTo(clientX, clientY, scaleMultiplier, event) {
const prevMatrix = this.state.matrix;
const prevScale = this.state.scale;
const scale = prevScale * scaleMultiplier;
const clientMatrix = this.el.ownerSVGElement.getScreenCTM();
const x = (clientX * clientMatrix.a) - clientMatrix.e;
const y = (clientY * clientMatrix.d) - clientMatrix.f;
// guardrails for scale max and min
if (scale > this.props.maxScale || scale < this.props.minScale) {
return;
}
this.setState({
scale,
matrix: [
scale,
prevMatrix[1],
prevMatrix[2],
scale,
x - (scaleMultiplier * (x - prevMatrix[4])),
y - (scaleMultiplier * (y - prevMatrix[5])),
],
}, () => this.props.onZoom(event, scale));
}