1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-12-25 02:15:29 +01:00
This commit is contained in:
Marek Kaluba 2022-02-23 16:28:10 +01:00
parent e279a0acf0
commit aa9a1cfdb6
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 8 additions and 27 deletions

View File

@ -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)

View File

@ -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)
;