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() {
|
||||
// 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 =
|
||||
localStorage.getItem("mask_blur") == null
|
||||
? 0
|
||||
|
|
|
@ -76,9 +76,12 @@ async function getStyles() {
|
|||
};
|
||||
|
||||
// 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 =
|
||||
localStorage.getItem("neg_prompt") || defaultNegativePrompt;
|
||||
storedNeg === null ? defaultNegativePrompt : storedNeg;
|
||||
|
||||
promptEl.value = promptEl.title = promptDefaultValue;
|
||||
negativePromptEl.value = negativePromptEl.title = negativePromptDefaultValue;
|
||||
|
|
|
@ -1024,10 +1024,29 @@ const dreamTool = () =>
|
|||
|
||||
state.selected.bb = bb;
|
||||
|
||||
state.erasePrevReticle = _reticle_draw(bb, state, "Dream", {
|
||||
w: bb.w,
|
||||
h: bb.h,
|
||||
});
|
||||
const style =
|
||||
state.cursorSize > stableDiffusionData.width
|
||||
? "#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;
|
||||
}
|
||||
|
||||
|
@ -1315,10 +1334,22 @@ const img2imgTool = () =>
|
|||
|
||||
request = {width: bb.w, height: bb.h};
|
||||
|
||||
state.erasePrevReticle = _reticle_draw(bb, state, "Img2Img", {
|
||||
w: bb.w,
|
||||
h: bb.h,
|
||||
});
|
||||
state.erasePrevReticle = _reticle_draw(
|
||||
bb,
|
||||
state,
|
||||
"Img2Img",
|
||||
{
|
||||
w: Math.round(
|
||||
bb.w * (stableDiffusionData.width / state.cursorSize)
|
||||
),
|
||||
h: Math.round(
|
||||
bb.h * (stableDiffusionData.height / state.cursorSize)
|
||||
),
|
||||
},
|
||||
{
|
||||
sizeTextStyle: style,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
bb = getBoundingBox(
|
||||
evn.x,
|
||||
|
|
Loading…
Reference in a new issue