diff options
| author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-02-18 19:17:12 -0500 |
|---|---|---|
| committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-02-18 19:17:12 -0500 |
| commit | 57be7b707694fcc3a2a7a6da6c8cd7782e4eb088 (patch) | |
| tree | 70e89815c84abfdcb87884893485e10784c81b80 /src | |
| parent | 1bffa19d7b2c085a2f647a0269acdc05630d5146 (diff) | |
debugging pendulum
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/views/nodes/PhysicsSimulationWeight.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/nodes/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsSimulationWeight.tsx index e77cfa96a..7c26334bf 100644 --- a/src/client/views/nodes/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsSimulationWeight.tsx @@ -31,6 +31,7 @@ export interface IWeightProps { } interface IState { + angleLabel: number, clickPositionX: number, clickPositionY: number, dragging: boolean, @@ -54,6 +55,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { dragging: false, kineticFriction: false, timer: 0, + angleLabel: 0, updatedStartPosX: this.props.dataDoc['startPosX'], updatedStartPosY: this.props.dataDoc['startPosY'], xPosition: this.props.dataDoc['startPosX'], @@ -206,6 +208,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setState({yPosition: yPos}) this.setState({updatedStartPosX: xPos}) this.setState({updatedStartPosY: yPos}) + this.setState({angleLabel: Math.round(this.props.dataDoc['pendulumAngle'] * 100) / 100}) } // Update x start position if (this.props.startPosX != prevProps.startPosX) { @@ -353,6 +356,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { magnitude: mag, directionInDegrees: angle, }; + this.setState({angleLabel: Math.round(oppositeAngle * 100) / 100}) return [this.forceOfGravity, forceOfTension]; }; @@ -502,8 +506,6 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setState({xPosition: xPos}); this.setState({yPosition: yPos}); - console.log("start forces" this.props.dataDoc['startForces']) - console.log("updated forces" this.props.dataDoc['updatedForces']) this.props.dataDoc['updatedForces'] = (this.getNewForces(xPos, yPos, xVel, yVel)); }; @@ -630,7 +632,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { backgroundColor: this.labelBackgroundColor, }} > - {Math.round(this.props.dataDoc['pendulumAngle'] * 100) / 100}° + {this.state.angleLabel}° </p> </div> )} |
