1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-07-27 13:05:31 +02:00

finally fix zoom issue

This commit is contained in:
Marek Kaluba 2022-02-23 16:26:42 +01:00
parent 0ae4f333ed
commit e279a0acf0
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -152,15 +152,16 @@ async function create_svg(
}
d3.select("input").on("input", function () {
let n = nodes.find(n => n.id == this.value)
let id = this.value;
let n = nodes.find(n => n.id == id)
if (n) {
foreground_descendants(n.id)
// let transform = {k:1, x:n.x, y:n.y}
console.log(n)
foreground_descendants(id)
d3.zoom().translateTo(svg_content,n.x, n.y)
// console.log(transform)
// svg_content.attr("transform", `translate(${n.x/2},${n.y/2})`)
svg.transition()
.duration(750)
.call(zoom.transform, d3.zoomIdentity);
zoom.translateTo(svg.transition().duration(750), n.x, n.y)
}
});