unrelated to scripts but kinda neato autolayers option

This commit is contained in:
tim h 2023-01-27 20:00:48 -06:00
parent fc0d6d136d
commit 464da36e2a
2 changed files with 19 additions and 0 deletions

View file

@ -515,6 +515,10 @@ const _generate = async (endpoint, request, bb, options = {}) => {
ctx.drawImage(keepUnmaskCanvas, 0, 0);
}
if (localStorage.getItem("openoutpaint/settings.autolayer") == "true") {
commands.runCommand("addLayer", "Added Layer", {});
}
commands.runCommand("drawImage", "Image Dream", {
x: bb.x,
y: bb.y,

View file

@ -90,6 +90,10 @@
Lie to HRfix:
<input id="hrfix-liar" class="canvas-size-input" type="checkbox" />
</label>
<label style="display: flex">
New Layer per Dream:
<input id="autolayer" class="canvas-size-input" type="checkbox" />
</label>
<script>
const canvasWidth = document.getElementById("canvas-width");
@ -98,6 +102,7 @@
const minCfg = document.getElementById("min-cfg");
const maxCfg = document.getElementById("max-cfg");
const hrfixLiar = document.getElementById("hrfix-liar");
const autolayer = document.getElementById("autolayer");
function writeToLocalStorage() {
localStorage.setItem(
@ -115,6 +120,10 @@
"openoutpaint/settings.hrfix-liar",
hrfixLiar.checked
);
localStorage.setItem(
"openoutpaint/settings.autolayer",
autolayer.checked
);
}
// Loads values from local storage
@ -133,6 +142,11 @@
? true
: localStorage.getItem("openoutpaint/settings.hrfix-liar") === "true";
hrfixLiar.checked = _enable_dishonesty;
let _enable_autolayers =
localStorage.getItem("openoutpaint/settings.autolayer") === null
? false
: localStorage.getItem("openoutpaint/settings.autolayer") === "true";
autolayer.checked = _enable_autolayers;
writeToLocalStorage();
@ -142,6 +156,7 @@
minCfg.onchange = writeToLocalStorage;
maxCfg.onchange = writeToLocalStorage;
hrfixLiar.onchange = writeToLocalStorage;
autolayer.onchange = writeToLocalStorage;
</script>
</body>
</html>