...also implements 164 quite similarly

This commit is contained in:
tim h 2023-01-10 17:00:45 -06:00
parent b166efc5e2
commit 16c2b36c1b

View file

@ -517,6 +517,17 @@ const _generate = async (endpoint, request, bb, options = {}) => {
}); });
}; };
const removeImg = async () => {
if (!images[at]) return;
images.splice(at, 1);
seeds.splice(at, 1);
if (at >= images.length) at = 0;
imageindextxt.textContent = `${at}/${images.length - 1}`;
var seed = seeds[at];
seedbtn.title = "Use seed " + seed;
redraw();
};
const makeMore = async () => { const makeMore = async () => {
const moreQ = await waitQueue(); const moreQ = await waitQueue();
try { try {
@ -596,6 +607,9 @@ const _generate = async (endpoint, request, bb, options = {}) => {
case "+": case "+":
makeMore(); makeMore();
break; break;
case "-":
removeImg();
break;
default: default:
switch (evn.code) { switch (evn.code) {
case "ArrowRight": case "ArrowRight":
@ -659,7 +673,11 @@ const _generate = async (endpoint, request, bb, options = {}) => {
const oncancelhandler = mouse.listen.world.btn.right.onclick.on( const oncancelhandler = mouse.listen.world.btn.right.onclick.on(
(evn, state) => { (evn, state) => {
if (!state.dream_processed && bb.contains(evn.x, evn.y)) { if (!state.dream_processed && bb.contains(evn.x, evn.y)) {
discardImg(); if (images.length > 1) {
removeImg();
} else {
discardImg();
}
imageCollection.inputElement.style.cursor = "auto"; imageCollection.inputElement.style.cursor = "auto";
state.dream_processed = true; state.dream_processed = true;
} }
@ -743,6 +761,12 @@ const _generate = async (endpoint, request, bb, options = {}) => {
morebtn.addEventListener("click", makeMore); morebtn.addEventListener("click", makeMore);
imageSelectMenu.appendChild(morebtn); imageSelectMenu.appendChild(morebtn);
const removebtn = document.createElement("button");
removebtn.textContent = "-";
removebtn.title = "Remove From Batch";
removebtn.addEventListener("click", removeImg);
imageSelectMenu.appendChild(removebtn);
const acceptbtn = document.createElement("button"); const acceptbtn = document.createElement("button");
acceptbtn.textContent = "Y"; acceptbtn.textContent = "Y";
acceptbtn.title = "Apply Current"; acceptbtn.title = "Apply Current";