diff --git a/webapp/path_navigator.html b/webapp/path_navigator.html index ea7a588..101e9b0 100644 --- a/webapp/path_navigator.html +++ b/webapp/path_navigator.html @@ -734,7 +734,7 @@ } } - // Fundamental input - auto-send on Enter, Up/Down arrows, or input change + // Fundamental input - send on Enter, Up/Down arrows document.getElementById("fundamentalInput").addEventListener("keydown", (e) => { if (e.key === "Enter") { e.preventDefault(); @@ -752,10 +752,24 @@ } }); - // Also trigger on input change (for the spinner buttons) - document.getElementById("fundamentalInput").addEventListener("input", () => { - setFundamental(); - }); + async function setFundamental() { + const input = document.getElementById("fundamentalInput"); + const fundamental = parseFloat(input.value); + if (!fundamental || fundamental <= 0) { + return; + } + try { + const response = await fetch("/api/set-fundamental", { + method: "POST", + headers: {"Content-Type": "application/json"}, + body: JSON.stringify({ fundamental: fundamental }) + }); + const data = await response.json(); + console.log("Fundamental set to:", data.fundamental, "Hz"); + } catch (e) { + console.log("Error setting fundamental", e); + } + } // File input handler document.getElementById("loadFileBtn").addEventListener("click", async () => {