mirror of
https://github.com/kalmarek/SmallHyperbolic
synced 2024-11-27 08:30:27 +01:00
finally fix zoom issue
This commit is contained in:
parent
0ae4f333ed
commit
e279a0acf0
15
docs/morphisms/js/d3_visualisation.js
vendored
15
docs/morphisms/js/d3_visualisation.js
vendored
@ -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)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user