Skip to content

Commit

Permalink
Adjust batch image prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
space-nuko committed Jun 2, 2023
1 parent a5f42ce commit 75dcbce
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions web/scripts/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,15 @@ const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
if (graphCanvas == null)
return;

const panel = graphCanvas.createPanel("Pick Images", { closable: true });
panel.node = node;
panel.classList.add("multiimageupload_dialog");
if (imagesWidget.panel != null)
return

imagesWidget.panel = graphCanvas.createPanel("Pick Images", { closable: true });
imagesWidget.panel.onClose = () => {
imagesWidget.panel = null;
}
imagesWidget.panel.node = node;
imagesWidget.panel.classList.add("multiimageupload_dialog");
const swap = (arr, i, j) => {
const temp = arr[i];
arr[i] = arr[j];
Expand All @@ -595,7 +601,7 @@ const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
<div class="right">
</div>
`;
const rootElem = panel.addHTML(rootHtml, "root");
const rootElem = imagesWidget.panel.addHTML(rootHtml, "root");
const left = rootElem.querySelector('.left')
const right = rootElem.querySelector('.right')

Expand Down Expand Up @@ -658,13 +664,23 @@ const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
inner_refresh();
})

const clearButton = panel.addButton("Clear", () => {
imagesWidget.panel.footer.style.display = "flex";

const clearButton = imagesWidget.panel.addButton("Clear", () => {
imagesWidget.value = []
showImages(imagesWidget.value);
inner_refresh();
})
clearButton.style.display = "block";
clearButton.style.marginLeft = "initial";
clearButton.style.height = "28px";

const okButton = imagesWidget.panel.addButton("OK", () => {
imagesWidget.panel.close();
})
okButton.style.display = "block";
okButton.style.height = "28px";
okButton.style.marginLeft = "auto";

const inner_refresh = () => {
left.innerHTML = ""
Expand Down Expand Up @@ -728,7 +744,7 @@ const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
}

inner_refresh();
document.body.appendChild(panel);
document.body.appendChild(imagesWidget.panel);
}, { serialize: false });

const uploadWidget = node.addWidget("button", "choose files to upload", "images", () => {
Expand Down

0 comments on commit 75dcbce

Please sign in to comment.