Cap gain in nextAt and currentAt to 0 after modifier
This commit is contained in:
parent
eb434656b3
commit
b478999e7e
1 changed files with 4 additions and 0 deletions
|
@ -150,6 +150,7 @@ export function createLinearScaling(
|
||||||
if (conversion.gainModifier) {
|
if (conversion.gainModifier) {
|
||||||
current = conversion.gainModifier.revert(current);
|
current = conversion.gainModifier.revert(current);
|
||||||
}
|
}
|
||||||
|
current = Decimal.max(0, current);
|
||||||
return Decimal.times(current, unref(coefficient)).add(unref(base));
|
return Decimal.times(current, unref(coefficient)).add(unref(base));
|
||||||
},
|
},
|
||||||
nextAt(conversion) {
|
nextAt(conversion) {
|
||||||
|
@ -157,6 +158,7 @@ export function createLinearScaling(
|
||||||
if (conversion.gainModifier) {
|
if (conversion.gainModifier) {
|
||||||
next = conversion.gainModifier.revert(next);
|
next = conversion.gainModifier.revert(next);
|
||||||
}
|
}
|
||||||
|
next = Decimal.max(0, next);
|
||||||
return Decimal.times(next, unref(coefficient)).add(unref(base)).max(unref(base));
|
return Decimal.times(next, unref(coefficient)).add(unref(base)).max(unref(base));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -184,6 +186,7 @@ export function createPolynomialScaling(
|
||||||
if (conversion.gainModifier) {
|
if (conversion.gainModifier) {
|
||||||
current = conversion.gainModifier.revert(current);
|
current = conversion.gainModifier.revert(current);
|
||||||
}
|
}
|
||||||
|
current = Decimal.max(0, current);
|
||||||
return Decimal.root(current, unref(exponent)).times(unref(base));
|
return Decimal.root(current, unref(exponent)).times(unref(base));
|
||||||
},
|
},
|
||||||
nextAt(conversion) {
|
nextAt(conversion) {
|
||||||
|
@ -191,6 +194,7 @@ export function createPolynomialScaling(
|
||||||
if (conversion.gainModifier) {
|
if (conversion.gainModifier) {
|
||||||
next = conversion.gainModifier.revert(next);
|
next = conversion.gainModifier.revert(next);
|
||||||
}
|
}
|
||||||
|
next = Decimal.max(0, next);
|
||||||
return Decimal.root(next, unref(exponent)).times(unref(base)).max(unref(base));
|
return Decimal.root(next, unref(exponent)).times(unref(base)).max(unref(base));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue