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" wasm-bindgen = "0.2.63"
console_error_panic_hook = "0.1.6" console_error_panic_hook = "0.1.6"
wee_alloc = "0.4.5" wee_alloc = "0.4.5"
sbp = { path = "../sbp", features = ["f32"] } sbp = { path = "../sbp", features = ["f32", "fast-float"] }
ndarray = "0.13.1" ndarray = "0.13.1"
euler = { path = "../euler" } euler = { path = "../euler" }
maxwell = { path = "../maxwell" } 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"> <label for="yN">N:</label><input type="number" name="yN" id="yN" placeholder="25" value="25" min="2">
</div> </div>
<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> </div>
<!-- <!--
Curvilinear? Inputting some random json? Curvilinear? Inputting some random json?

View File

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