diff options
-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> )} |