fix reject shortcut and add + shortcut to dream

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-11-30 18:57:40 -03:00
parent 6f99b15320
commit ce78370eb3
No known key found for this signature in database
GPG key ID: F369E3EA50A0DEEE

View file

@ -167,6 +167,14 @@ const _generate = async (endpoint, request, bb) => {
}); });
}; };
const makeMore = async () => {
let stopProgress = _monitorProgress(bb);
images.push(...(await _dream(endpoint, requestCopy)));
stopProgress();
imageindextxt.textContent = `${at + 1}/${images.length}`;
};
const discardImg = async () => { const discardImg = async () => {
clean(); clean();
}; };
@ -184,6 +192,11 @@ const _generate = async (endpoint, request, bb) => {
break; break;
} }
switch (evn.key) {
case "+":
makeMore();
break;
default:
switch (evn.code) { switch (evn.code) {
case "ArrowRight": case "ArrowRight":
nextImg(); nextImg();
@ -191,15 +204,14 @@ const _generate = async (endpoint, request, bb) => {
case "ArrowLeft": case "ArrowLeft":
prevImg(); prevImg();
break; break;
case "Enter": case "Escape":
applyImg();
break;
case "Esc":
applyImg(); applyImg();
break; break;
default: default:
break; break;
} }
break;
}
}; };
keyboard.listen.onkeyclick.on(onarrow); keyboard.listen.onkeyclick.on(onarrow);
@ -254,13 +266,7 @@ const _generate = async (endpoint, request, bb) => {
const morebtn = document.createElement("button"); const morebtn = document.createElement("button");
morebtn.textContent = "+"; morebtn.textContent = "+";
morebtn.title = "Generate More"; morebtn.title = "Generate More";
morebtn.addEventListener("click", async () => { morebtn.addEventListener("click", makeMore);
let stopProgress = _monitorProgress(bb);
images.push(...(await _dream(endpoint, requestCopy)));
stopProgress();
imageindextxt.textContent = `${at + 1}/${images.length}`;
});
imageSelectMenu.appendChild(morebtn); imageSelectMenu.appendChild(morebtn);
const acceptbtn = document.createElement("button"); const acceptbtn = document.createElement("button");