forked from extern/easydiffusion
Fix removal of image modifiers with non-zero weights
Properly handles removal of image modifiers that had (((modifiers))) or [[[modifiers]]] updated at runtime.
This commit is contained in:
parent
c4bad5c454
commit
e278e639a3
@ -87,9 +87,9 @@ function createModifierGroup(modifierGroup, initiallyExpanded) {
|
|||||||
modifiersEl.appendChild(modifierCard)
|
modifiersEl.appendChild(modifierCard)
|
||||||
|
|
||||||
modifierCard.addEventListener('click', () => {
|
modifierCard.addEventListener('click', () => {
|
||||||
if (activeTags.map(x => x.name).includes(modifierName)) {
|
if (activeTags.map(x => trimModifiers(x.name)).includes(trimModifiers(modifierName))) {
|
||||||
// remove modifier from active array
|
// remove modifier from active array
|
||||||
activeTags = activeTags.filter(x => x.name != modifierName)
|
activeTags = activeTags.filter(x => trimModifiers(x.name) != trimModifiers(modifierName))
|
||||||
modifierCard.classList.remove(activeCardClass)
|
modifierCard.classList.remove(activeCardClass)
|
||||||
|
|
||||||
modifierCard.querySelector('.modifier-card-image-overlay').innerText = '+'
|
modifierCard.querySelector('.modifier-card-image-overlay').innerText = '+'
|
||||||
@ -125,6 +125,10 @@ function createModifierGroup(modifierGroup, initiallyExpanded) {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trimModifiers(tag) {
|
||||||
|
return tag.replace(/^\(+|\)+$/g, '').replace(/^\[+|\]+$/g, '')
|
||||||
|
}
|
||||||
|
|
||||||
async function loadModifiers() {
|
async function loadModifiers() {
|
||||||
try {
|
try {
|
||||||
let res = await fetch('/get/modifiers')
|
let res = await fetch('/get/modifiers')
|
||||||
|
Loading…
Reference in New Issue
Block a user