Keep disabled modifiers when making formulas

This commit is contained in:
Seth Posner 2024-02-12 07:58:39 -08:00
parent 4f807aaf96
commit cf6265d8ce

View file

@ -297,9 +297,9 @@ export function createSequentialModifier<
getFormula: modifiers.every(m => m.getFormula != null) getFormula: modifiers.every(m => m.getFormula != null)
? (gain: FormulaSource) => ? (gain: FormulaSource) =>
modifiers modifiers
.filter(m => unref(m.enabled) !== false)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
.reduce((acc, curr) => curr.getFormula!(acc), gain) .reduce((acc, curr) => Formula.if(acc, curr.enabled ?? true,
acc => curr.getFormula!(acc), acc => acc), gain)
: undefined, : undefined,
enabled: modifiers.some(m => m.enabled != null) enabled: modifiers.some(m => m.enabled != null)
? computed(() => modifiers.filter(m => unref(m.enabled) !== false).length > 0) ? computed(() => modifiers.filter(m => unref(m.enabled) !== false).length > 0)