Add checkbox for gridlines

This commit is contained in:
Magnus Ulimoen 2021-02-12 17:16:36 +01:00
parent dc94aa8e6b
commit d11abff1c3
3 changed files with 12 additions and 3 deletions

View File

@ -11,7 +11,7 @@ crate-type = ["cdylib"]
wasm-bindgen = "0.2.63"
console_error_panic_hook = "0.1.6"
wee_alloc = "0.4.5"
sbp = { path = "../sbp", features = ["f32"] }
sbp = { path = "../sbp", features = ["f32", "fast-float"] }
ndarray = "0.13.1"
euler = { path = "../euler" }
maxwell = { path = "../maxwell" }

View File

@ -44,7 +44,10 @@
<label for="yN">N:</label><input type="number" name="yN" id="yN" placeholder="25" value="25" min="2">
</div>
<div>
<label for="diamond">Tilt grid </label><input type="checkbox" name="diamond" id="diamond">
<input type="checkbox" name="diamond" id="diamond"> <label for="diamond"> Tilt grid</label>
</div>
<div>
<input type="checkbox" name="gridlines" id="gridlines" checked=true><label for="gridlines"> Show gridlines</label>
</div>
<!--
Curvilinear? Inputting some random json?

View File

@ -431,8 +431,10 @@ class FieldDrawer {
}
let field = new Float32Array(wasm.memory.buffer, fieldPtr, width*height);
fieldDrawer.draw(field);
if (document.getElementById("gridlines").checked) {
lineDrawer.draw();
}
}
async function drawLoop() {
draw();
@ -536,4 +538,8 @@ class FieldDrawer {
draw();
}
}, {"passive": false});
setup();
is_setup = true;
animation = window.requestAnimationFrame(drawLoop);
}());