Merge branch 'main' into rotate

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2023-01-12 21:51:25 -03:00
commit c4d6826369
2 changed files with 26 additions and 2 deletions

View file

@ -373,7 +373,7 @@
src="js/ui/tool/generic.js?v=f5ad9d7" src="js/ui/tool/generic.js?v=f5ad9d7"
type="text/javascript"></script> type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=95c916d" type="text/javascript"></script> <script src="js/ui/tool/dream.js?v=3db7d6c" type="text/javascript"></script>
<script <script
src="js/ui/tool/maskbrush.js?v=1e8a893" src="js/ui/tool/maskbrush.js?v=1e8a893"
type="text/javascript"></script> type="text/javascript"></script>

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)) {
if (images.length > 1) {
removeImg();
} else {
discardImg(); 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";