moves overmask to txt2img/outpaint context menu

Former-commit-id: 0ee5c7946da0e037be950b3c3354e2cba87bdfca
This commit is contained in:
tim h 2022-11-23 23:43:51 -06:00
parent 9557c78fd2
commit eb46b36afb
4 changed files with 18 additions and 22 deletions

View file

@ -129,18 +129,8 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba
min="1" min="1"
max="16" /> max="16" />
<br /> <br />
<label for="cbxHRFix">Auto txt2img HRfix?</label>
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" /> <input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
<br /> <label for="cbxHRFix">Auto txt2img HRfix</label>
<label for="overMaskPx">Overmask px (0 to disable):</label>
<input
type="number"
id="overMaskPx"
onchange="changeOverMaskPx()"
min="0"
max="128"
value="16"
step="1" />
<br /> <br />
<label for="maskBlur">Mask blur:</label> <label for="maskBlur">Mask blur:</label>
<span id="maskBlurText"></span> <span id="maskBlurText"></span>

View file

@ -132,7 +132,7 @@ var backupMaskChunk = null;
var backupMaskX = null; var backupMaskX = null;
var backupMaskY = null; var backupMaskY = null;
var totalImagesReturned; var totalImagesReturned;
var overMaskPx = 16; var overMaskPx = 0;
var drawTargets = []; // is this needed? i only draw the last one anyway... var drawTargets = []; // is this needed? i only draw the last one anyway...
var dropTargets = []; // uhhh yeah similar to the above but for arbitrary dropped images var dropTargets = []; // uhhh yeah similar to the above but for arbitrary dropped images
var arbitraryImage; var arbitraryImage;
@ -587,8 +587,8 @@ function changeSeed() {
} }
function changeOverMaskPx() { function changeOverMaskPx() {
overMaskPx = document.getElementById("overMaskPx").value; // overMaskPx = document.getElementById("overMaskPx").value;
localStorage.setItem("overmask_px", overMaskPx); // localStorage.setItem("overmask_px", overMaskPx);
} }
function changeHiResFix() { function changeHiResFix() {
@ -993,5 +993,5 @@ function loadSettings() {
document.getElementById("maskBlur").value = Number(_mask_blur); document.getElementById("maskBlur").value = Number(_mask_blur);
document.getElementById("seed").value = Number(_seed); document.getElementById("seed").value = Number(_seed);
document.getElementById("cbxHRFix").checked = Boolean(_enable_hr); document.getElementById("cbxHRFix").checked = Boolean(_enable_hr);
document.getElementById("overMaskPx").value = Number(_overmask_px); // document.getElementById("overMaskPx").value = Number(_overmask_px);
} }

View file

@ -70,13 +70,8 @@ const dream_generate_callback = (evn, state) => {
auxCtx.fillRect(0, 0, bb.w, bb.h); auxCtx.fillRect(0, 0, bb.w, bb.h);
var currentMask = auxCanvas.toDataURL(); var currentMask = auxCanvas.toDataURL();
request.mask = request.mask =
document.getElementById("overMaskPx").value > 0 state.overMaskPx > 0
? applyOvermask( ? applyOvermask(auxCanvas, auxCtx, state.overMaskPx, currentMask)
auxCanvas,
auxCtx,
document.getElementById("overMaskPx").value,
currentMask
)
: currentMask; : currentMask;
// Dream // Dream
dream(bb.x, bb.y, request, {method: "img2img", stopMarching, bb}); dream(bb.x, bb.y, request, {method: "img2img", stopMarching, bb});

View file

@ -222,6 +222,7 @@ tools.dream = toolbar.registerTool(
{ {
init: (state) => { init: (state) => {
state.snapToGrid = true; state.snapToGrid = true;
state.overMaskPx = 0;
state.mousemovecb = (evn) => _reticle_draw(evn, state.snapToGrid); state.mousemovecb = (evn) => _reticle_draw(evn, state.snapToGrid);
state.dreamcb = (evn) => { state.dreamcb = (evn) => {
dream_generate_callback(evn, state); dream_generate_callback(evn, state);
@ -236,9 +237,19 @@ tools.dream = toolbar.registerTool(
"snapToGrid", "snapToGrid",
"Snap To Grid" "Snap To Grid"
).label; ).label;
state.ctxmenu.overMaskPxLabel = _toolbar_input.slider(
state,
"overMaskPx",
"Overmask px (0 to disable):",
0,
128,
1
).label;
} }
menu.appendChild(state.ctxmenu.snapToGridLabel); menu.appendChild(state.ctxmenu.snapToGridLabel);
menu.appendChild(document.createElement("br"));
menu.appendChild(state.ctxmenu.overMaskPxLabel);
}, },
shortcut: "D", shortcut: "D",
} }