diff --git a/src/app/components/Modification.jsx b/src/app/components/Modification.jsx index f9a74df4..b68d6e10 100644 --- a/src/app/components/Modification.jsx +++ b/src/app/components/Modification.jsx @@ -34,14 +34,15 @@ export default class ModificationsMenu extends TranslatedComponent { _updateValue(value) { let scaledValue = Math.floor(Number(value) * 100); // Limit to +1000% / -100% - if (scaledValue > 10000) { - scaledValue = 10000; + if (scaledValue > 100000) { + scaledValue = 100000; value = 1000; } - if (scaledValue < -1000) { - scaledValue = -1000; + if (scaledValue < -10000) { + scaledValue = -10000; value = -100; } + let m = this.props.m; let name = this.props.name; let ship = this.props.ship; @@ -62,7 +63,7 @@ export default class ModificationsMenu extends TranslatedComponent { return (
{translate(name)}{name === 'jitter' ? ' (°)' : ' (%)'}
- +
); } diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 11b5db17..50610b21 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -402,6 +402,11 @@ export default class Ship { * @param {Number} value The new value of the modification. The value of the modification is scaled to provide two decimal places of precision in an integer. For example 1.23% is stored as 123 */ setModification(m, name, value) { + if (isNaN(value)) { + // Value passed is invalid; reset it to 0 + value = 0; + } + // Handle special cases if (name === 'pgen') { // Power generation