From e680ef59016b5574d765327cabaf5b5acd961adb Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Mon, 1 May 2023 18:32:02 -0400 Subject: debugging --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 96 +++++++++++----------- .../PhysicsBox/PhysicsSimulationInputField.tsx | 1 - .../nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 1 + 3 files changed, 50 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 1e817a22d..b7bc81f38 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -35,8 +35,10 @@ import "./PhysicsSimulationBox.scss"; import { InputField } from "./PhysicsSimulationInputField"; import questions from "./PhysicsSimulationQuestions.json"; import tutorials from "./PhysicsSimulationTutorial.json"; -import { IWallProps, Wall } from "./PhysicsSimulationWall"; -import { IForce, Weight } from "./PhysicsSimulationWeight"; +import Wall from "./PhysicsSimulationWall"; +import IWall from "./PhysicsSimulationWall"; +import Weight from "./PhysicsSimulationWeight"; +import IForce from "./PhysicsSimulationWeight"; interface VectorTemplate { top: number; left: number; @@ -99,9 +101,9 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { const normalForce: IForce = { description: "Normal Force", - magnitude: Math.abs(this.gravity) * Math.cos(Math.atan(height / width)) * this.mass, + magnitude: Math.abs(this.dataDoc.gravity) * Math.cos(Math.atan(height / width)) * this.dataDoc.mass, directionInDegrees: 180 - 90 - (Math.atan(height / width) * 180) / Math.PI, component: false, @@ -382,14 +384,14 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent + return

Step {this.dataDoc.stepNumber + 1}:{" "} - {this.dataDoc.selectedTutorial.steps[stepNumber].description} + {this.dataDoc.selectedTutorial.steps[this.dataDoc.stepNumber].description}

-

{this.dataDoc.selectedTutorial.steps[stepNumber].content}

+

{this.dataDoc.selectedTutorial.steps[this.dataDoc.stepNumber].content}

{ @@ -1849,7 +1851,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.simulationReset(!this.dataDoc.simulationReset); }} @@ -1986,9 +1988,9 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.startPendulumAngle = (value); - if (simulationType == "Pendulum") { + if (this.dataDoc.simulationType == "Pendulum") { const mag = - mass * + this.dataDoc.mass * Math.abs(this.dataDoc.gravity) * Math.cos((value * Math.PI) / 180); @@ -2027,8 +2029,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - if (simulationType == "Pendulum") { + if (this.dataDoc.simulationType == "Pendulum") { this.dataDoc.adjustPendulumAngle = ({ angle: this.dataDoc.pendulumAngle, length: value, @@ -2413,7 +2415,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent - {simulationType == "Circular Motion" ? "Z" : "Y"} + {this.dataDoc.simulationType == "Circular Motion" ? "Z" : "Y"}

diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx index 645c1995e..75bc28919 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx @@ -45,7 +45,6 @@ export default class InputField extends React.Component { this.margin = this.props.small ? "0px" : "10px"; } - componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { if (prevProps.value != this.props.value) { if (this.props.mode == "Freeform") { diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index deecb03de..89bdae0a0 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -891,6 +891,7 @@ export default class Weight extends React.Component { // Render weight, spring, rod(s), vectors render () { + return