From eb46b36afbbb27ffd8b026a648e92dbe15fedf07 Mon Sep 17 00:00:00 2001 From: tim h Date: Wed, 23 Nov 2022 23:43:51 -0600 Subject: [PATCH] moves overmask to txt2img/outpaint context menu Former-commit-id: 0ee5c7946da0e037be950b3c3354e2cba87bdfca --- index.html | 12 +----------- js/index.js | 8 ++++---- js/ui/tool/dream.js | 9 ++------- js/ui/toolbar.js | 11 +++++++++++ 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/index.html b/index.html index e3b3ec3..dadf004 100644 --- a/index.html +++ b/index.html @@ -129,18 +129,8 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba min="1" max="16" />
- -
- - +
diff --git a/js/index.js b/js/index.js index 55b4d97..ee88c30 100644 --- a/js/index.js +++ b/js/index.js @@ -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); } diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index 0738464..36fbc05 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -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}); diff --git a/js/ui/toolbar.js b/js/ui/toolbar.js index 59a3621..ea7cbac 100644 --- a/js/ui/toolbar.js +++ b/js/ui/toolbar.js @@ -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", }