mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
fix: zoomTo to use svg size and not graph size
This commit is contained in:
parent
b267e832b5
commit
c6dd331eb6
3 changed files with 3 additions and 3 deletions
2
main.js
2
main.js
|
|
@ -457,7 +457,7 @@ function handleZoom(isScaleChanged, isPositionChanged) {
|
|||
|
||||
// Zoom to a specific point
|
||||
function zoomTo(x, y, z = 8, d = 2000) {
|
||||
const transform = d3.zoomIdentity.translate(x * -z + graphWidth / 2, y * -z + graphHeight / 2).scale(z);
|
||||
const transform = d3.zoomIdentity.translate(x * -z + svgWidth / 2, y * -z + svgHeight / 2).scale(z);
|
||||
svg.transition().duration(d).call(zoom.transform, transform);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue