2023-02-24 17:02:20 -05:00
|
|
|
document
|
|
|
|
.getElementById("controls-container")
|
|
|
|
.addEventListener("mouseover", () => {
|
|
|
|
document.getElementById("controls").style.display = "block";
|
|
|
|
document.getElementById("expand-show").style.display = "none";
|
|
|
|
});
|
2023-02-24 20:17:35 -05:00
|
|
|
|
2023-02-24 17:02:20 -05:00
|
|
|
document
|
|
|
|
.getElementById("controls-container")
|
|
|
|
.addEventListener("mouseout", () => {
|
|
|
|
document.getElementById("controls").style.display = "none";
|
|
|
|
document.getElementById("expand-show").style.display = "inline";
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById("reset").addEventListener("click", () => {
|
|
|
|
state = reset_state(state);
|
|
|
|
|
|
|
|
state.target = rand_target(state.rows, state.cols);
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById("solve").addEventListener("click", () => {
|
|
|
|
if (!cx.eq(state.path.at(-2), new cx(0, 0))) state = reset_state(state);
|
|
|
|
|
|
|
|
state.solution = sol(state.target);
|
|
|
|
});
|
|
|
|
|
|
|
|
document
|
|
|
|
.getElementById("directions")
|
|
|
|
.addEventListener("click", () => directions_modal.show());
|
2023-02-24 20:17:35 -05:00
|
|
|
|
|
|
|
document.getElementById("gap").addEventListener("input", function () {
|
|
|
|
state.changes.gap = Number(this.value);
|
|
|
|
});
|