mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-25 00:19:09 +01:00
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
|
// 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
|
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)
|
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({
|
activeTags.push({
|
||||||
'name': modifierName,
|
'name': tag,
|
||||||
'element': imageModifierCard,
|
'element': imageModifierCard,
|
||||||
'originElement': modifierCard
|
'originElement': modifierCard
|
||||||
})
|
})
|
||||||
|
@ -26,15 +26,25 @@
|
|||||||
|
|
||||||
const delta = Math.sign(event.deltaY)
|
const delta = Math.sign(event.deltaY)
|
||||||
let s = i.parentElement.getElementsByClassName('modifier-card-label')[0].getElementsByTagName("p")[0].innerText
|
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) {
|
if (delta < 0) {
|
||||||
// wheel scrolling up
|
// wheel scrolling up
|
||||||
if (s.substring(0, 1) == '[' && s.substring(s.length-1) == ']') {
|
if (s.substring(0, 1) == '[' && s.substring(s.length-1) == ']') {
|
||||||
s = s.substring(1, s.length - 1)
|
s = s.substring(1, s.length - 1)
|
||||||
|
t = t.substring(1, t.length - 1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.substring(0, 10) !== '('.repeat(10) && s.substring(s.length-10) !== ')'.repeat(10)) {
|
if (s.substring(0, 10) !== '('.repeat(10) && s.substring(s.length-10) !== ')'.repeat(10)) {
|
||||||
s = '(' + s + ')'
|
s = '(' + s + ')'
|
||||||
|
t = '(' + t + ')'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,11 +52,13 @@
|
|||||||
// wheel scrolling down
|
// wheel scrolling down
|
||||||
if (s.substring(0, 1) == '(' && s.substring(s.length-1) == ')') {
|
if (s.substring(0, 1) == '(' && s.substring(s.length-1) == ')') {
|
||||||
s = s.substring(1, s.length - 1)
|
s = s.substring(1, s.length - 1)
|
||||||
|
t = t.substring(1, t.length - 1)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.substring(0, 10) !== '['.repeat(10) && s.substring(s.length-10) !== ']'.repeat(10)) {
|
if (s.substring(0, 10) !== '['.repeat(10) && s.substring(s.length-10) !== ']'.repeat(10)) {
|
||||||
s = '[' + s + ']'
|
s = '[' + s + ']'
|
||||||
|
t = '[' + t + ']'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +66,7 @@
|
|||||||
// update activeTags
|
// update activeTags
|
||||||
for (let it = 0; it < overlays.length; it++) {
|
for (let it = 0; it < overlays.length; it++) {
|
||||||
if (i == overlays[it]) {
|
if (i == overlays[it]) {
|
||||||
activeTags[it].name = s
|
activeTags[it].name = t
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user