diff --git a/docs/morphisms/js/d3_visualisation.js b/docs/morphisms/js/d3_visualisation.js index 7c7a1f0..4609b07 100644 --- a/docs/morphisms/js/d3_visualisation.js +++ b/docs/morphisms/js/d3_visualisation.js @@ -68,8 +68,6 @@ async function create_svg( .attr("value", n=>n.id) .text(n=>n.id) - - const simulation = d3.forceSimulation(nodes) .force("link", d3.forceLink(links).id(d => d.id)) .force("charge", d3.forceManyBody().strength(-400)) @@ -205,7 +203,6 @@ async function create_svg( const zoom = d3.zoom() .scaleExtent([0.2, 5]) - // .translateExtent([[0, 0], [width, height]]) .on("zoom", (e) => { console.log(e.transform) svg_content.attr("transform", e.transform) diff --git a/docs/morphisms/js/morphisms.js b/docs/morphisms/js/morphisms.js index d8807e7..27e7e7b 100644 --- a/docs/morphisms/js/morphisms.js +++ b/docs/morphisms/js/morphisms.js @@ -8,10 +8,7 @@ async function fetch_json(url) { } catch (err) { console.log("Error while fetching json:" + err); } -} - - - ; +}; async function place_svg(svg) { d3.select("div.canvas") @@ -19,7 +16,8 @@ async function place_svg(svg) { .attr("class", "container-fluid") .attr("class", "svg-container") .node() - .appendChild(svg.node()); + .appendChild(svg.node()) + ; }; async function add_search() { @@ -28,37 +26,23 @@ async function add_search() { .classed("search-field", true) .append("div") .classed("container", true) - // .append("div") - // .classed("input-group", true) ; - // let floating = input_grp.insert("div") - // .attr("class", "form-floating") let input = input_grp.insert("input") .attr("class", "form-control") .attr("list", "datalistOptions") .attr("id", "groupSearch") - .attr("placeholder", "Type to search..."); - - // input_grp.insert("label") - // .attr("for", "groupSearch") - // .text("Type to search...") + .attr("placeholder", "Type to search...") + ; input_grp.insert("datalist") .attr("id", "datalistOptions") + ; - // input_grp.append("button") - // .classed("btn btn-primary", true) - // .attr("type", "button") - // .attr("id", "searchBtn") - // .append("i") - // .classed("bi-search", true) - // ; } -async function show_katex() { +async function switch_katex(toggle=true) { let math_objects = document.getElementsByClassName("math"); - let toggle = true; for (let elt of math_objects) { toggleKaTeX(elt, toggle); let fObj = elt.parentElement; @@ -77,7 +61,7 @@ fetch_json(morphisms_url) }) // .then(async (data) => { console.log(data); return data; }) .then(place_svg) - .then(show_katex) + .then(switch_katex) // .then(add_search) ;