diff --git a/src/App.css b/src/App.css index 54b34f1..f7955c2 100644 --- a/src/App.css +++ b/src/App.css @@ -54,4 +54,13 @@ body{ .popover{ max-width: 100%! important; z-index: 900! important; +} + +.btn-group-toggle{ + display: flex! important; +} + +.row{ + margin-left: 0! important; + margin-right: 0! important; } \ No newline at end of file diff --git a/src/SettingsBar.tsx b/src/SettingsBar.tsx index ad06679..4242e70 100644 --- a/src/SettingsBar.tsx +++ b/src/SettingsBar.tsx @@ -9,13 +9,14 @@ class CalculationRadio extends React.Component<{settings: T.settingsT}, {value: super(props); this.state = {value: this.props.settings.calculationSettings.calculationMethod}; } - setCalcMethod = (event) => { + private setCalcMethod = (event) => { const value = parseInt(event.target.value); this.props.settings.calculationSettings.calculationMethod = value; this.setState({value: parseInt(event.target.value)}); } render(){ return( + Adams-Bashforth 5 @@ -30,6 +31,7 @@ class CalculationRadio extends React.Component<{settings: T.settingsT}, {value: Runge-Kutta 4 + ); } } @@ -51,20 +53,11 @@ export class SettingsBar extends React.Component { - if(id === 'timeStep'){ - return this.props.settings.calculationSettings.timeStep; - }else{ - return this.props.settings.calculationSettings.launchAngle[id]; + calculations : { + launchAngle : [['min', 'Minimum', '°'], ['max', 'Maximum', '°'], ['precision', 'Increment', '°']], + numericalMethod : [['timeStep', 'Time Step', 's']] } } render(){ @@ -84,20 +77,33 @@ export class SettingsBar extends React.Component { + if(value === ''){return 'error';} + const numValue = parseFloat(value); + this.props.settings.calculationSettings.launchAngle[id] = numValue; + } + const handleNumericalMethodChange = (value: string, id: string) : void | string => { if(value === ''){return 'error';} const numValue = parseFloat(value); if(id === 'timeStep'){ if(numValue <= 0){return 'error';} this.props.settings.calculationSettings.timeStep = numValue; - }else{ - this.props.settings.calculationSettings.launchAngle[id] = numValue; } } - const generateCalculationForm = () => { - return this.forms.calculations.map((value, i) => { + const generateLaunchAngleForm = () => { + return this.forms.calculations.launchAngle.map((value, i) => { + const initialValue = this.props.settings.calculationSettings.launchAngle[value[0]]; + return( + + ); + }); + } + const generateNumericalMethodForm = () => { + return this.forms.calculations.numericalMethod.map((value, i) => { + const initialValue = this.props.settings.calculationSettings[value[0]]; return( - + ); }); } @@ -111,15 +117,10 @@ export class SettingsBar extends React.Component { - if(value === ''){ - return 'error'; - } + if(value === ''){return 'error';} const numValues = parseFloat(value) / 100; - if(numValues > 1 || numValues < 0){ - return 'error'; - } + if(numValues > 1 || numValues < 0){return 'error';} this.props.settings.format.colors[id] = numValues; - //console.log(this.props.settings.format.colors[id]); } return(<> @@ -158,11 +159,12 @@ export class SettingsBar extends React.Component

Launch Angle

- {generateCalculationForm()} + {generateLaunchAngleForm()} - -

Numerical Method

+ +

Numerical Analysis

+ {generateNumericalMethodForm()}