Skip to content

Commit

Permalink
Merge pull request #253 from zero01101/more_button_fixes
Browse files Browse the repository at this point in the history
adds options for + button to update prompt in request and jump to new…
  • Loading branch information
zero01101 committed Aug 12, 2023
2 parents 5abf591 + e5dfa4f commit 674bdbe
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ this is a completely vanilla javascript and html canvas outpainting convenience
- arbitrary dream reticle size - draw the rectangle of your dreams
- an [effectively infinite](https://github.com/zero01101/openOutpaint/pull/108), resizable, scalable canvas for you to paint all over
- **_NOTE: v0.0.10 introduces a new "camera control" modifier key - hold [`CTRL`] and use the scrollwheel to zoom (scroll the wheel or use the two-finger vertical gesture on, uh, modern touchpads) and pan (hold the scrollwheel button, or if you don't have one, left-click button) around the canvas_**
- extremely limited, janky support for a shockingly restrictive list of A1111 extensions including controlnet inpainting for legitimately [magic](https://github.com/Mikubill/sd-webui-controlnet/discussions/1464) [promptless inpainting](https://github.com/Mikubill/sd-webui-controlnet/discussions/1143) and [outpainting](https://github.com/Mikubill/sd-webui-controlnet/discussions/1597) and in-line reference preprocessors for keeping existing style while replacing things (reference requires at least 2 controlnet units enabled in A1111 settings), as well as a very very basic dynamic-prompts-on-or-off toggle
- extremely limited, janky support for a shockingly restrictive list of A1111 extensions including controlnet inpainting for legitimately magic promptless inpainting and outpainting ([a](https://github.com/Mikubill/sd-webui-controlnet/discussions/1464), [b](https://github.com/Mikubill/sd-webui-controlnet/discussions/1143), [c](https://github.com/Mikubill/sd-webui-controlnet/discussions/1597)) and in-line reference preprocessors for keeping existing style while replacing things (reference requires at least 2 controlnet units enabled in A1111 settings), as well as a very very basic dynamic-prompts-on-or-off toggle
- **_NOTE: this is_ JANKY, _pull requests greatly welcomed lol_**
- a very nicely functional and familiar layer system
- save, load, import, and export workspaces - includes all your layers, history, canvas size, you name it!
Expand Down
11 changes: 5 additions & 6 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ body {
max-height: 0;
overflow-y: clip;
overflow-x: visible;
transition:
max-height 0.2s ease-out,
height 0s ease-out;
transition: max-height 0.2s ease-out, height 0s ease-out;
}

.menu-container {
Expand Down Expand Up @@ -132,9 +130,10 @@ body {

border-radius: 10px;

min-width: 360px;
width: 360px;
/* min-height: 250px; */
min-width: 400px;
width: 400px;
min-height: 260px;
height: 260px;

color: var(--c-text);

Expand Down
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
Expand All @@ -7,7 +7,7 @@
<link href="css/colors.css?v=f732f19" rel="stylesheet" />
<link href="css/icons.css?v=e6f94af" rel="stylesheet" />

<link href="css/index.css?v=fad20a2" rel="stylesheet" />
<link href="css/index.css?v=a1f5bff" rel="stylesheet" />
<link href="css/layers.css?v=92c0352" rel="stylesheet" />

<link href="css/ui/generic.css?v=30837f8" rel="stylesheet" />
Expand Down Expand Up @@ -315,8 +315,8 @@
<br />
<span id="version">
<a href="https://github.com/zero01101/openOutpaint" target="_blank">
<s>Alpha release v0.0.16.4</s>
v20230722.002
<s>Alpha release v0.0.16.5</s>
v20230812.001
</a>
<br />
<a
Expand Down Expand Up @@ -553,7 +553,7 @@
src="js/ui/tool/generic.js?v=3e678e0"
type="text/javascript"></script>

<script src="js/ui/tool/dream.js?v=c97af5b" type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=95bd3f0" type="text/javascript"></script>
<script
src="js/ui/tool/maskbrush.js?v=e9bd0eb"
type="text/javascript"></script>
Expand Down
36 changes: 26 additions & 10 deletions js/ui/tool/dream.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ const _monitorProgress = (bb, oncheck = null) => {
}

const timeSpent = performance.now() - init;
setTimeout(
() => {
if (running) _checkProgress();
},
Math.max(0, minDelay - timeSpent)
);
setTimeout(() => {
if (running) _checkProgress();
}, Math.max(0, minDelay - timeSpent));
};

_checkProgress();
Expand Down Expand Up @@ -697,10 +694,29 @@ const _generate = async (endpoint, request, bb, options = {}) => {
parseInt(requestCopy.seed) +
requestCopy.batch_size * requestCopy.n_iter;
}

if (
localStorage.getItem(
"openoutpaint/settings.update-prompt-on-more-button"
) == "true"
) {
requestCopy.prompt = document.getElementById("prompt").value;
requestCopy.negative_prompt =
document.getElementById("negPrompt").value;
}
dreamData = await _dream(endpoint, requestCopy);
images.push(...dreamData.images);
seeds.push(...dreamData.seeds);
updateImageIndexText();
if (
localStorage.getItem(
"openoutpaint/settings.jump-to-1st-new-on-more-button"
) == "true"
) {
at = images.length - requestCopy.n_iter * requestCopy.batch_size;
activateImgAt(at);
} else {
updateImageIndexText();
}
} catch (e) {
if (alertCount < 2) {
notifications.notify(
Expand Down Expand Up @@ -2035,9 +2051,9 @@ const dreamTool = () =>
"outpainting_fill",
"Outpaint Type",
{
0: "fill (SDXL?)",
1: "original (SDXL?)",
2: "latent noise (SD1.x/2.x)",
0: "fill",
1: "original",
2: "latent noise (suggested)",
3: "latent nothing",
},
2, // AVOID ORIGINAL FOR OUTPAINT OR ELSE but we still give you the option because we love you and because it seems to work better for SDXL
Expand Down
56 changes: 54 additions & 2 deletions pages/configuration.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
Expand All @@ -7,7 +7,7 @@
<link href="../css/colors.css?v=f732f19" rel="stylesheet" />
<link href="../css/icons.css?v=e6f94af" rel="stylesheet" />

<link href="../css/index.css?v=fad20a2" rel="stylesheet" />
<link href="../css/index.css?v=a1f5bff" rel="stylesheet" />
<link href="../css/layers.css?v=92c0352" rel="stylesheet" />

<link href="../css/ui/generic.css?v=30837f8" rel="stylesheet" />
Expand Down Expand Up @@ -142,6 +142,24 @@
onchange="changeSmoothRendering()" />
</td>
</tr>
<tr>
<td class="title">+ Button Updates Prompt</td>
<td class="input">
<input
id="cbxUpdatePromptOnMoreButton"
class="canvas-size-input"
type="checkbox" />
</td>
</tr>
<tr>
<td class="title">Jump to 1st New on +</td>
<td class="input">
<input
id="cbxJumpTo1stNewOnMoreButton"
class="canvas-size-input"
type="checkbox" />
</td>
</tr>
<!-- //TODO implement this
<tr>
<td class="title">Marching Ants Update MS</td>
Expand All @@ -165,6 +183,12 @@
const hrfixLiar = document.getElementById("hrfix-liar");
const autolayer = document.getElementById("autolayer");
const smoothRendering = document.getElementById("cbxSmooth");
const updatePromptOnMoreButton = document.getElementById(
"cbxUpdatePromptOnMoreButton"
);
const jumpTo1stNewOnMoreButton = document.getElementById(
"cbxJumpTo1stNewOnMoreButton"
);

function writeToLocalStorage() {
localStorage.setItem(
Expand All @@ -190,6 +214,14 @@
"openoutpaint/settings.smooth",
smoothRendering.checked
);
localStorage.setItem(
"openoutpaint/settings.update-prompt-on-more-button",
updatePromptOnMoreButton.checked
);
localStorage.setItem(
"openoutpaint/settings.jump-to-1st-new-on-more-button",
jumpTo1stNewOnMoreButton.checked
);
}

// Loads values from local storage
Expand Down Expand Up @@ -219,6 +251,24 @@
: localStorage.getItem("openoutpaint/settings.smooth") === "true";
smoothRendering.checked = _enable_smooth;

let _enable_update_prompt_on_more_button =
localStorage.getItem(
"openoutpaint/settings.update-prompt-on-more-button"
) === null
? true
: localStorage.getItem(
"openoutpaint/settings.update-prompt-on-more-button"
) === "true";

let _enable_jump_to_1st_new_on_more_button =
localStorage.getItem(
"openoutpaint/settings.jump-to-1st-new-on-more-button"
) === null
? true
: localStorage.getItem(
"openoutpaint/settings.jump-to-1st-new-on-more-button"
) === "true";

writeToLocalStorage();

canvasWidth.onchange = writeToLocalStorage;
Expand All @@ -229,6 +279,8 @@
hrfixLiar.onchange = writeToLocalStorage;
autolayer.onchange = writeToLocalStorage;
smoothRendering.onchange = writeToLocalStorage;
updatePromptOnMoreButton.onchange = writeToLocalStorage;
jumpTo1stNewOnMoreButton.onchange = writeToLocalStorage;
</script>
</body>
</html>

0 comments on commit 674bdbe

Please sign in to comment.