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"
max="16" />
<br />
<label for="cbxHRFix">Auto txt2img HRfix?</label>
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
<br />
<label for="overMaskPx">Overmask px (0 to disable):</label>
<input
type="number"
id="overMaskPx"
onchange="changeOverMaskPx()"
min="0"
max="128"
value="16"
step="1" />
<label for="cbxHRFix">Auto txt2img HRfix</label>
<br />
<label for="maskBlur">Mask blur:</label>
<span id="maskBlurText"></span>

View file

@ -132,7 +132,7 @@ var backupMaskChunk = null;
var backupMaskX = null;
var backupMaskY = null;
var totalImagesReturned;
var overMaskPx = 16;
var overMaskPx = 0;
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 arbitraryImage;
@ -587,8 +587,8 @@ function changeSeed() {
}
function changeOverMaskPx() {
overMaskPx = document.getElementById("overMaskPx").value;
localStorage.setItem("overmask_px", overMaskPx);
// overMaskPx = document.getElementById("overMaskPx").value;
// localStorage.setItem("overmask_px", overMaskPx);
}
function changeHiResFix() {
@ -993,5 +993,5 @@ function loadSettings() {
document.getElementById("maskBlur").value = Number(_mask_blur);
document.getElementById("seed").value = Number(_seed);
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);
var currentMask = auxCanvas.toDataURL();
request.mask =
document.getElementById("overMaskPx").value > 0
? applyOvermask(
auxCanvas,
auxCtx,
document.getElementById("overMaskPx").value,
currentMask
)
state.overMaskPx > 0
? applyOvermask(auxCanvas, auxCtx, state.overMaskPx, currentMask)
: currentMask;
// Dream
dream(bb.x, bb.y, request, {method: "img2img", stopMarching, bb});

View file

@ -222,6 +222,7 @@ tools.dream = toolbar.registerTool(
{
init: (state) => {
state.snapToGrid = true;
state.overMaskPx = 0;
state.mousemovecb = (evn) => _reticle_draw(evn, state.snapToGrid);
state.dreamcb = (evn) => {
dream_generate_callback(evn, state);
@ -236,9 +237,19 @@ tools.dream = toolbar.registerTool(
"snapToGrid",
"Snap To Grid"
).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(document.createElement("br"));
menu.appendChild(state.ctxmenu.overMaskPxLabel);
},
shortcut: "D",
}