Skip to content

Commit

Permalink
Fix issue with input fields values
Browse files Browse the repository at this point in the history
  • Loading branch information
kotsiossp97 committed Mar 15, 2024
1 parent c7e7bad commit 9c70102
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions src/lib/angleCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ export const AngleCalculator = {
* b: left,
* c: ypoteinousa
*/
const a = parseFloat(centerWidth)
const b = parseFloat(leftWidth)
const c = parseFloat(ypotinousa)

const cosC =
(Math.pow(centerWidth, 2) +
Math.pow(leftWidth, 2) -
Math.pow(ypotinousa, 2)) /
(2 * centerWidth * leftWidth);
(Math.pow(a, 2) +
Math.pow(b, 2) -
Math.pow(c, 2)) /
(2 * a * b);

const c = Math.acos(cosC);
const angleRad = Math.acos(cosC);
const arcConst = 180 / Math.PI;
return (c * arcConst)
return (angleRad * arcConst)
},
};
6 changes: 3 additions & 3 deletions src/models/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export interface ICalcResults {
}

export interface IAngleCalcInputs {
centerWidth: number;
leftWidth: number;
ypotinousa: number;
centerWidth: string;
leftWidth: string;
ypotinousa: string;
}

export interface IAngleCalcResults {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Triples/InputsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const InputsCard: React.FC<IInputsCardProps> = (props) => {
} = props;

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = parseFloat(e.target.value);
const value = e.target.value;
const id = e.target.id;
// if (!value) return;

Expand Down

0 comments on commit 9c70102

Please sign in to comment.