aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/edit-attention.js
diff options
context:
space:
mode:
authoryfszzx <yfszzx@gmail.com>2022-10-12 13:24:40 +0000
committeryfszzx <yfszzx@gmail.com>2022-10-12 13:24:40 +0000
commitc87c3b9c1169f8a9b632d6d8c8675d98956c387c (patch)
treeeeeb4ff5e05af265686ce3a7916a0df2f30113e4 /javascript/edit-attention.js
parent511ca57e37483aac0cf260c89838ad2948509101 (diff)
parent429442f4a6aab7301efb89d27bef524fe827e81a (diff)
downloadstable-diffusion-webui-gfx803-c87c3b9c1169f8a9b632d6d8c8675d98956c387c.tar.gz
stable-diffusion-webui-gfx803-c87c3b9c1169f8a9b632d6d8c8675d98956c387c.tar.bz2
stable-diffusion-webui-gfx803-c87c3b9c1169f8a9b632d6d8c8675d98956c387c.zip
test
Diffstat (limited to 'javascript/edit-attention.js')
-rw-r--r--javascript/edit-attention.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/javascript/edit-attention.js b/javascript/edit-attention.js
index 0280c603..3f1d2fbb 100644
--- a/javascript/edit-attention.js
+++ b/javascript/edit-attention.js
@@ -25,6 +25,7 @@ addEventListener('keydown', (event) => {
} else {
end = target.value.slice(selectionEnd + 1).indexOf(")") + 1;
weight = parseFloat(target.value.slice(selectionEnd + 1, selectionEnd + 1 + end));
+ if (isNaN(weight)) return;
if (event.key == minus) weight -= 0.1;
if (event.key == plus) weight += 0.1;
@@ -38,4 +39,7 @@ addEventListener('keydown', (event) => {
target.selectionStart = selectionStart;
target.selectionEnd = selectionEnd;
}
+ // Since we've modified a Gradio Textbox component manually, we need to simulate an `input` DOM event to ensure its
+ // internal Svelte data binding remains in sync.
+ target.dispatchEvent(new Event("input", { bubbles: true }));
});