fix reset logic

This commit is contained in:
Kevin Gibbons 2022-08-29 08:26:14 -07:00
parent d9eab7f383
commit 754525be82
2 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,7 @@
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
<label title="Set to -1 for random seed" for="seed">Seed:</label>
<input value="-1" type="number" id="seed" name="seed">
<button type="button" id="reset">&olarr;</button>
<button type="button" id="reset-seed">&olarr;</button>
<span>&bull;</span>
<button type="button" id="reset-all">Reset to Defaults</button>
<br>

View File

@ -47,8 +47,10 @@ function loadFields(form) {
}
function clearFields(form) {
localStorage.clear()
location.reload()
localStorage.clear();
let prompt = form.prompt.value;
form.reset();
form.prompt.value = prompt;
}
async function generateSubmit(form) {
@ -116,7 +118,7 @@ window.onload = () => {
document.querySelector("#generate-form").addEventListener('change', (e) => {
saveFields(e.target.form);
});
document.querySelector("#reset").addEventListener('click', (e) => {
document.querySelector("#reset-seed").addEventListener('click', (e) => {
document.querySelector("#seed").value = -1;
saveFields(e.target.form);
});