fix transparent color not affecting downstream slots

This commit is contained in:
Henry Jameson 2020-01-24 00:56:47 +02:00
parent 75fa07626d
commit d7e7f47b66

View File

@ -326,7 +326,7 @@ export const getColors = (sourceColors, sourceOpacity, mod) => SLOT_ORDERED.redu
} else { } else {
let color = { ...colors[deps[0]] } let color = { ...colors[deps[0]] }
if (value.color) { if (value.color) {
color = value.color(mod, ...deps.map((dep) => ({ ...colors[dep] }))) color = colorFunc(mod, ...deps.map((dep) => ({ ...colors[dep] })))
} }
outputColor = getTextColor( outputColor = getTextColor(
@ -348,8 +348,14 @@ export const getColors = (sourceColors, sourceOpacity, mod) => SLOT_ORDERED.redu
} }
const opacitySlot = getOpacitySlot(key) const opacitySlot = getOpacitySlot(key)
if (opacitySlot && outputColor.a === undefined) { if (opacitySlot && outputColor.a === undefined) {
const deps = getDependencies(key, SLOT_INHERITANCE)
const dependencySlot = deps && deps[0]
if (dependencySlot && sourceColors[dependencySlot] === 'transparent') {
outputColor.a = 0
} else {
outputColor.a = sourceOpacity[opacitySlot] || OPACITIES[opacitySlot].defaultValue || 1 outputColor.a = sourceOpacity[opacitySlot] || OPACITIES[opacitySlot].defaultValue || 1
} }
}
if (opacitySlot) { if (opacitySlot) {
return { return {
colors: { ...colors, [key]: outputColor }, colors: { ...colors, [key]: outputColor },