diff options
author | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-04-21 07:37:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 07:37:29 +0000 |
commit | 27d02597c78a1b189c57feea12ba522d61a56c2e (patch) | |
tree | b759a346655ae17806bcbab423c4cb46994c95a4 | |
parent | 7ef5551634f8d06301929cb43069f5bf37ee8f1a (diff) | |
download | stable-diffusion-webui-gfx803-27d02597c78a1b189c57feea12ba522d61a56c2e.tar.gz stable-diffusion-webui-gfx803-27d02597c78a1b189c57feea12ba522d61a56c2e.tar.bz2 stable-diffusion-webui-gfx803-27d02597c78a1b189c57feea12ba522d61a56c2e.zip |
Remove parentheses if weight == 1
-rw-r--r-- | javascript/edit-attention.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/javascript/edit-attention.js b/javascript/edit-attention.js index 5fe1117c..c02d292f 100644 --- a/javascript/edit-attention.js +++ b/javascript/edit-attention.js @@ -99,7 +99,13 @@ function keyupEditAttention(event){ weight = parseFloat(weight.toPrecision(12));
if(String(weight).length == 1) weight += ".0"
- text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + 1 + end - 1);
+ if (closeCharacter == ')' && weight == 1) {
+ text = text.slice(0, selectionStart - 1) + text.slice(selectionStart, selectionEnd) + text.slice(selectionEnd + 5);
+ selectionStart--;
+ selectionEnd--;
+ } else {
+ text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + 1 + end - 1);
+ }
target.focus();
target.value = text;
@@ -111,4 +117,4 @@ function keyupEditAttention(event){ addEventListener('keydown', (event) => {
keyupEditAttention(event);
-});
\ No newline at end of file +});
|