index 0 not counted as an image anymore

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-09 23:18:24 -03:00
parent 43a2677af0
commit ba7c7608c0

View file

@ -222,7 +222,7 @@ const _generate = async (
at--; at--;
if (at < 0) at = images.length - 1; if (at < 0) at = images.length - 1;
imageindextxt.textContent = `${at}/${images.length}`; imageindextxt.textContent = `${at}/${images.length - 1}`;
redraw(); redraw();
}; };
@ -230,7 +230,7 @@ const _generate = async (
at++; at++;
if (at >= images.length) at = 0; if (at >= images.length) at = 0;
imageindextxt.textContent = `${at}/${images.length}`; imageindextxt.textContent = `${at}/${images.length - 1}`;
redraw(); redraw();
}; };
@ -256,7 +256,7 @@ const _generate = async (
interruptButton.disabled = false; interruptButton.disabled = false;
imageCollection.inputElement.appendChild(interruptButton); imageCollection.inputElement.appendChild(interruptButton);
images.push(...(await _dream(endpoint, requestCopy))); images.push(...(await _dream(endpoint, requestCopy)));
imageindextxt.textContent = `${at}/${images.length}`; imageindextxt.textContent = `${at}/${images.length - 1}`;
} catch (e) { } catch (e) {
alert( alert(
`Error generating images. Please try again or see consolde for more details` `Error generating images. Please try again or see consolde for more details`
@ -330,11 +330,11 @@ const _generate = async (
imageSelectMenu = makeElement("div", bb.x, bb.y + bb.h); imageSelectMenu = makeElement("div", bb.x, bb.y + bb.h);
const imageindextxt = document.createElement("button"); const imageindextxt = document.createElement("button");
imageindextxt.textContent = `${at}/${images.length}`; imageindextxt.textContent = `${at}/${images.length - 1}`;
imageindextxt.addEventListener("click", () => { imageindextxt.addEventListener("click", () => {
at = 0; at = 0;
imageindextxt.textContent = `${at}/${images.length}`; imageindextxt.textContent = `${at}/${images.length - 1}`;
redraw(); redraw();
}); });