From 794ef10fc861e526b20b0b166cbd9ead708181ac Mon Sep 17 00:00:00 2001 From: tim h Date: Tue, 20 Dec 2022 08:45:23 -0600 Subject: [PATCH 1/5] tiny fix; adds vertical scrollbar to expanded prompt history --- css/index.css | 1 + 1 file changed, 1 insertion(+) diff --git a/css/index.css b/css/index.css index cd43ba3..a39c2c6 100644 --- a/css/index.css +++ b/css/index.css @@ -467,6 +467,7 @@ div.prompt-wrapper > .prompt-indicator.styles::after { #prompt-history.expanded { width: 300px; + overflow-y: auto; } #prompt-history .entry { From f942f03799185b6267f6f3a4350f776f83852a84 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Tue, 20 Dec 2022 12:23:45 -0300 Subject: [PATCH 2/5] fixed fixed host Signed-off-by: Victor Seiji Hariki --- js/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/index.js b/js/index.js index 2b072f6..088632b 100644 --- a/js/index.js +++ b/js/index.js @@ -189,6 +189,7 @@ function startup() { function setFixedHost(host, changePromptMessage) { const hostInput = document.getElementById("host"); + host = value; hostInput.value = host; hostInput.readOnly = true; hostInput.style.cursor = "default"; From 04f5b0a56b349586337cc37f68e2f4cc2f192b13 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Tue, 20 Dec 2022 13:43:57 -0300 Subject: [PATCH 3/5] fix2 host Signed-off-by: Victor Seiji Hariki --- js/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/index.js b/js/index.js index 088632b..97a0821 100644 --- a/js/index.js +++ b/js/index.js @@ -187,10 +187,10 @@ function startup() { changeSyncCursorSize(); } -function setFixedHost(host, changePromptMessage) { +function setFixedHost(h, changePromptMessage) { const hostInput = document.getElementById("host"); - host = value; - hostInput.value = host; + host = h; + hostInput.value = h; hostInput.readOnly = true; hostInput.style.cursor = "default"; hostInput.style.backgroundColor = "#ddd"; From 94de86a971753968e94b0b6c27990e5253c825d3 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Tue, 20 Dec 2022 23:26:52 -0300 Subject: [PATCH 4/5] webui set prompt and stamp uictx cursor Signed-off-by: Victor Seiji Hariki --- js/ui/tool/stamp.js | 23 +++++++++++++++-------- js/webui.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/js/ui/tool/stamp.js b/js/ui/tool/stamp.js index 1189bb3..2722fde 100644 --- a/js/ui/tool/stamp.js +++ b/js/ui/tool/stamp.js @@ -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) => { diff --git a/js/webui.js b/js/webui.js index bdc4ca4..9995582 100644 --- a/js/webui.js +++ b/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; From 35d586885459e8023a0d125b71b9676114191957 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Tue, 20 Dec 2022 23:43:29 -0300 Subject: [PATCH 5/5] make stamp redraw on zoom Signed-off-by: Victor Seiji Hariki --- js/ui/tool/stamp.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/ui/tool/stamp.js b/js/ui/tool/stamp.js index 2722fde..5aa1811 100644 --- a/js/ui/tool/stamp.js +++ b/js/ui/tool/stamp.js @@ -327,6 +327,10 @@ const stampTool = () => uiCtx.restore(); }; + state.redraw = () => { + state.movecb(state.lastMouseMove); + }; + state.drawcb = (evn) => { let x = evn.x; let y = evn.y;