forked from extern/easydiffusion
Fix restoration of weighted tasks with truncated modifiers (#956)
* Fix restoration of weighted tasks with truncated modifiers * Reverting this change Will create a separate PR for this as needed. Doesn't impact the other bug fix. * Update utils.js
This commit is contained in:
parent
995bdc77b8
commit
079402cb2f
@ -176,9 +176,9 @@ function refreshModifiersState(newTags) {
|
||||
// add modifier to active array
|
||||
if (!activeTags.map(x => x.name).includes(tag)) { // only add each tag once even if several custom modifier cards share the same tag
|
||||
const imageModifierCard = modifierCard.cloneNode(true)
|
||||
imageModifierCard.querySelector('.modifier-card-label p').innerText = shortModifierName
|
||||
imageModifierCard.querySelector('.modifier-card-label p').innerText = tag.replace(modifierName, shortModifierName)
|
||||
activeTags.push({
|
||||
'name': modifierName,
|
||||
'name': tag,
|
||||
'element': imageModifierCard,
|
||||
'originElement': modifierCard
|
||||
})
|
||||
|
@ -26,15 +26,25 @@
|
||||
|
||||
const delta = Math.sign(event.deltaY)
|
||||
let s = i.parentElement.getElementsByClassName('modifier-card-label')[0].getElementsByTagName("p")[0].innerText
|
||||
let t
|
||||
// find the corresponding tag
|
||||
for (let it = 0; it < overlays.length; it++) {
|
||||
if (i == overlays[it]) {
|
||||
t = activeTags[it].name
|
||||
break
|
||||
}
|
||||
}
|
||||
if (delta < 0) {
|
||||
// wheel scrolling up
|
||||
if (s.substring(0, 1) == '[' && s.substring(s.length-1) == ']') {
|
||||
s = s.substring(1, s.length - 1)
|
||||
t = t.substring(1, t.length - 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.substring(0, 10) !== '('.repeat(10) && s.substring(s.length-10) !== ')'.repeat(10)) {
|
||||
s = '(' + s + ')'
|
||||
t = '(' + t + ')'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,11 +52,13 @@
|
||||
// wheel scrolling down
|
||||
if (s.substring(0, 1) == '(' && s.substring(s.length-1) == ')') {
|
||||
s = s.substring(1, s.length - 1)
|
||||
t = t.substring(1, t.length - 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.substring(0, 10) !== '['.repeat(10) && s.substring(s.length-10) !== ']'.repeat(10)) {
|
||||
s = '[' + s + ']'
|
||||
t = '[' + t + ']'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,7 +66,7 @@
|
||||
// update activeTags
|
||||
for (let it = 0; it < overlays.length; it++) {
|
||||
if (i == overlays[it]) {
|
||||
activeTags[it].name = s
|
||||
activeTags[it].name = t
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user