Skip to content

Commit

Permalink
Merge branch 'main' into clear_brush_mask_option
Browse files Browse the repository at this point in the history
  • Loading branch information
zero01101 committed Dec 22, 2022
2 parents a49769a + 35d5868 commit 1f407c4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
1 change: 1 addition & 0 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ div.prompt-wrapper > .prompt-indicator.styles::after {

#prompt-history.expanded {
width: 300px;
overflow-y: auto;
}

#prompt-history .entry {
Expand Down
5 changes: 3 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ function startup() {
changeSyncCursorSize();
}

function setFixedHost(host, changePromptMessage) {
function setFixedHost(h, changePromptMessage) {
const hostInput = document.getElementById("host");
hostInput.value = host;
host = h;
hostInput.value = h;
hostInput.readOnly = true;
hostInput.style.cursor = "default";
hostInput.style.backgroundColor = "#ddd";
Expand Down
29 changes: 20 additions & 9 deletions js/ui/tool/stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -309,15 +314,21 @@ const stampTool = () =>
}

// Draw current cursor location
ovCtx.lineWidth = 3;
ovCtx.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.lineWidth = 3;
uiCtx.strokeStyle = "#FFF";

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.redraw = () => {
state.movecb(state.lastMouseMove);
};

state.drawcb = (evn) => {
Expand Down
30 changes: 30 additions & 0 deletions js/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1f407c4

Please sign in to comment.