mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-16 01:48:24 +08:00
viz: check node exists before anchoring zoom (#16627)
This commit is contained in:
@@ -187,7 +187,7 @@ function renderDag(layoutSpec, { recenter }) {
|
||||
}).attr("class", e => e.value.label.type).attr("id", e => `${e.v}-${e.w}`).datum(e => ({ text:e.value.label.text })));
|
||||
if (anchor != null) {
|
||||
const n = g.node(anchor.id);
|
||||
d3.select("#graph-svg").call(svgZoom.transform, d3.zoomIdentity.translate(anchor.x-n.x*anchor.k, anchor.y-n.y*anchor.k).scale(anchor.k));
|
||||
if (n != null) d3.select("#graph-svg").call(svgZoom.transform, d3.zoomIdentity.translate(anchor.x-n.x*anchor.k, anchor.y-n.y*anchor.k).scale(anchor.k));
|
||||
} else if (recenter) document.getElementById("zoom-to-fit-btn").click();
|
||||
anchor = null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user