From 16c2b36c1baf885ecc1e748ef2fed8175119d1d6 Mon Sep 17 00:00:00 2001 From: tim h Date: Tue, 10 Jan 2023 17:00:45 -0600 Subject: [PATCH 1/2] ...also implements 164 quite similarly --- js/ui/tool/dream.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index daa0670..aed0098 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -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 moreQ = await waitQueue(); try { @@ -596,6 +607,9 @@ const _generate = async (endpoint, request, bb, options = {}) => { case "+": makeMore(); break; + case "-": + removeImg(); + break; default: switch (evn.code) { case "ArrowRight": @@ -659,7 +673,11 @@ const _generate = async (endpoint, request, bb, options = {}) => { const oncancelhandler = mouse.listen.world.btn.right.onclick.on( (evn, state) => { if (!state.dream_processed && bb.contains(evn.x, evn.y)) { - discardImg(); + if (images.length > 1) { + removeImg(); + } else { + discardImg(); + } imageCollection.inputElement.style.cursor = "auto"; state.dream_processed = true; } @@ -743,6 +761,12 @@ const _generate = async (endpoint, request, bb, options = {}) => { morebtn.addEventListener("click", makeMore); 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"); acceptbtn.textContent = "Y"; acceptbtn.title = "Apply Current"; From 1ad9dd1e087aa4dd38a987069308664e4555092a Mon Sep 17 00:00:00 2001 From: zero01101 Date: Tue, 10 Jan 2023 23:02:32 +0000 Subject: [PATCH 2/2] Fixed resource hashes --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 2494d65..af89d74 100644 --- a/index.html +++ b/index.html @@ -371,7 +371,7 @@ src="js/ui/tool/generic.js?v=2bcd36d" type="text/javascript"> - +