webui set prompt and stamp uictx cursor
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
04f5b0a56b
commit
94de86a971
2 changed files with 45 additions and 8 deletions
|
@ -299,6 +299,11 @@ const stampTool = () =>
|
|||
y += snap(evn.y, 0, 64);
|
||||
}
|
||||
|
||||
const vpc = viewport.canvasToView(x, y);
|
||||
uiCtx.clearRect(0, 0, uiCanvas.width, uiCanvas.height);
|
||||
|
||||
uiCtx.save();
|
||||
|
||||
state.lastMouseMove = evn;
|
||||
|
||||
ovLayer.clear();
|
||||
|
@ -309,15 +314,17 @@ const stampTool = () =>
|
|||
}
|
||||
|
||||
// Draw current cursor location
|
||||
ovCtx.lineWidth = 3;
|
||||
ovCtx.strokeStyle = "#FFF";
|
||||
uiCtx.lineWidth = 3;
|
||||
uiCtx.strokeStyle = "#FFF";
|
||||
|
||||
ovCtx.beginPath();
|
||||
ovCtx.moveTo(x, y + 10);
|
||||
ovCtx.lineTo(x, y - 10);
|
||||
ovCtx.moveTo(x + 10, y);
|
||||
ovCtx.lineTo(x - 10, y);
|
||||
ovCtx.stroke();
|
||||
uiCtx.beginPath();
|
||||
uiCtx.moveTo(vpc.x, vpc.y + 10);
|
||||
uiCtx.lineTo(vpc.x, vpc.y - 10);
|
||||
uiCtx.moveTo(vpc.x + 10, vpc.y);
|
||||
uiCtx.lineTo(vpc.x - 10, vpc.y);
|
||||
uiCtx.stroke();
|
||||
|
||||
uiCtx.restore();
|
||||
};
|
||||
|
||||
state.drawcb = (evn) => {
|
||||
|
|
30
js/webui.js
30
js/webui.js
|
@ -92,6 +92,36 @@
|
|||
};
|
||||
}
|
||||
break;
|
||||
case "openoutpaint/set-prompt":
|
||||
{
|
||||
const promptEl = document.getElementById("prompt");
|
||||
const negativePromptEl = document.getElementById("negPrompt");
|
||||
|
||||
if (data.prompt !== undefined) {
|
||||
promptEl.value = data.prompt;
|
||||
stableDiffusionData.prompt = promptEl.value;
|
||||
promptEl.title = promptEl.value;
|
||||
localStorage.setItem(
|
||||
"openoutpaint/prompt",
|
||||
stableDiffusionData.prompt
|
||||
);
|
||||
}
|
||||
|
||||
if (data.negPrompt !== undefined) {
|
||||
negativePromptEl.value = data.negPrompt;
|
||||
stableDiffusionData.negative_prompt = negativePromptEl.value;
|
||||
negativePromptEl.title = negativePromptEl.value;
|
||||
localStorage.setItem(
|
||||
"openoutpaint/neg_prompt",
|
||||
stableDiffusionData.negative_prompt
|
||||
);
|
||||
}
|
||||
|
||||
if (data.styles !== undefined) {
|
||||
styleSelectElement.value = data.styles;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.warn(`[webui] Unsupported message type: ${data.type}`);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue