fix loading empty prompts from local storage
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
fb83b126c7
commit
e2afb48703
3 changed files with 44 additions and 18 deletions
|
@ -890,14 +890,6 @@ async function upscaleAndDownload() {
|
||||||
|
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
// set default values if not set
|
// set default values if not set
|
||||||
var _prompt =
|
|
||||||
localStorage.getItem("prompt") == null
|
|
||||||
? "ocean floor scientific expedition, underwater wildlife"
|
|
||||||
: localStorage.getItem("prompt");
|
|
||||||
var _negprompt =
|
|
||||||
localStorage.getItem("neg_prompt") == null
|
|
||||||
? "people, person, humans, human, divers, diver, glitch, error, text, watermark, bad quality, blurry"
|
|
||||||
: localStorage.getItem("neg_prompt");
|
|
||||||
var _mask_blur =
|
var _mask_blur =
|
||||||
localStorage.getItem("mask_blur") == null
|
localStorage.getItem("mask_blur") == null
|
||||||
? 0
|
? 0
|
||||||
|
|
|
@ -76,9 +76,12 @@ async function getStyles() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load from local storage if set
|
// Load from local storage if set
|
||||||
const promptDefaultValue = localStorage.getItem("prompt") || defaultPrompt;
|
const storedPrompt = localStorage.getItem("prompt");
|
||||||
|
const storedNeg = localStorage.getItem("neg_prompt");
|
||||||
|
const promptDefaultValue =
|
||||||
|
storedPrompt === null ? defaultPrompt : storedPrompt;
|
||||||
const negativePromptDefaultValue =
|
const negativePromptDefaultValue =
|
||||||
localStorage.getItem("neg_prompt") || defaultNegativePrompt;
|
storedNeg === null ? defaultNegativePrompt : storedNeg;
|
||||||
|
|
||||||
promptEl.value = promptEl.title = promptDefaultValue;
|
promptEl.value = promptEl.title = promptDefaultValue;
|
||||||
negativePromptEl.value = negativePromptEl.title = negativePromptDefaultValue;
|
negativePromptEl.value = negativePromptEl.title = negativePromptDefaultValue;
|
||||||
|
|
|
@ -1024,10 +1024,29 @@ const dreamTool = () =>
|
||||||
|
|
||||||
state.selected.bb = bb;
|
state.selected.bb = bb;
|
||||||
|
|
||||||
state.erasePrevReticle = _reticle_draw(bb, state, "Dream", {
|
const style =
|
||||||
w: bb.w,
|
state.cursorSize > stableDiffusionData.width
|
||||||
h: bb.h,
|
? "#FBB5"
|
||||||
});
|
: state.cursorSize < stableDiffusionData.width
|
||||||
|
? "#BFB5"
|
||||||
|
: "#FFF5";
|
||||||
|
|
||||||
|
state.erasePrevReticle = _reticle_draw(
|
||||||
|
bb,
|
||||||
|
state,
|
||||||
|
"Dream",
|
||||||
|
{
|
||||||
|
w: Math.round(
|
||||||
|
bb.w * (stableDiffusionData.width / state.cursorSize)
|
||||||
|
),
|
||||||
|
h: Math.round(
|
||||||
|
bb.h * (stableDiffusionData.height / state.cursorSize)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sizeTextStyle: style,
|
||||||
|
}
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,10 +1334,22 @@ const img2imgTool = () =>
|
||||||
|
|
||||||
request = {width: bb.w, height: bb.h};
|
request = {width: bb.w, height: bb.h};
|
||||||
|
|
||||||
state.erasePrevReticle = _reticle_draw(bb, state, "Img2Img", {
|
state.erasePrevReticle = _reticle_draw(
|
||||||
w: bb.w,
|
bb,
|
||||||
h: bb.h,
|
state,
|
||||||
});
|
"Img2Img",
|
||||||
|
{
|
||||||
|
w: Math.round(
|
||||||
|
bb.w * (stableDiffusionData.width / state.cursorSize)
|
||||||
|
),
|
||||||
|
h: Math.round(
|
||||||
|
bb.h * (stableDiffusionData.height / state.cursorSize)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sizeTextStyle: style,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
bb = getBoundingBox(
|
bb = getBoundingBox(
|
||||||
evn.x,
|
evn.x,
|
||||||
|
|
Loading…
Reference in a new issue