1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-07-27 21:10: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 () { 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) { if (n) {
foreground_descendants(n.id) foreground_descendants(id)
// let transform = {k:1, x:n.x, y:n.y}
console.log(n)
d3.zoom().translateTo(svg_content,n.x, n.y) svg.transition()
// console.log(transform) .duration(750)
// svg_content.attr("transform", `translate(${n.x/2},${n.y/2})`) .call(zoom.transform, d3.zoomIdentity);
zoom.translateTo(svg.transition().duration(750), n.x, n.y)
} }
}); });