diff options
author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-04 00:31:13 -0400 |
---|---|---|
committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-04 00:31:13 -0400 |
commit | 7a773b075753e92112ad2d16e414eaaa8be59378 (patch) | |
tree | ea58e276edd8badcccbd47138160ac6b127c8eab /src | |
parent | d46f6bd5e4d0c3ad7d483de85538f86965f635b7 (diff) |
debug acceleration label
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index 785e40057..27f57070e 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -178,8 +178,13 @@ export default class Weight extends React.Component<IWeightProps, IState> { (-1 * Math.round(this.getNewAccelerationY(this.props.updatedForces) * 100)) / 100 ; this.props.dataDoc['accelerationXDisplay'] = - Math.round(this.getNewAccelerationX(this.props.dataDoc.updatedForces) * 100) / 100 + Math.round(this.getNewAccelerationX(this.props.updatedForces) * 100) / 100 ; + + this.setState({xAccel : (Math.round(this.getNewAccelerationX(this.props.updatedForces) * 100) / 100)}) + this.setState({yAccel : + (-1 * Math.round(this.getNewAccelerationY(this.props.updatedForces) * 100)) / 100 + }); }; componentDidUpdate(prevProps: Readonly<IWeightProps>, prevState: Readonly<IState>, snapshot?: any): void { @@ -471,10 +476,17 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.props.dataDoc['updatedForces2'] = (this.props.dataDoc['startForces2']) this.props.dataDoc['accelerationXDisplay'] = 0 this.props.dataDoc['accelerationYDisplay'] = 0 - this.props.dataDoc['positionXDisplay'] = this.state.updatedStartPosX - this.props.dataDoc['positionYDisplay'] = this.state.updatedStartPosY - this.props.dataDoc['velocityXDisplay'] = this.props.startVelX ?? 0 - this.props.dataDoc['velocityYDisplay'] = this.props.startVelY ?? 0 + if (this.props.color == 'red') { + this.props.dataDoc['positionXDisplay'] = this.state.updatedStartPosX + this.props.dataDoc['positionYDisplay'] = this.state.updatedStartPosY + this.props.dataDoc['velocityXDisplay'] = this.props.startVelX ?? 0 + this.props.dataDoc['velocityYDisplay'] = this.props.startVelY ?? 0 + } else { + this.props.dataDoc['positionXDisplay2'] = this.state.updatedStartPosX + this.props.dataDoc['positionYDisplay2'] = this.state.updatedStartPosY + this.props.dataDoc['velocityXDisplay2'] = this.props.startVelX ?? 0 + this.props.dataDoc['velocityYDisplay2'] = this.props.startVelY ?? 0 + } this.setState({angleLabel: Math.round(this.props.dataDoc['pendulumAngle'] ?? 0 * 100) / 100}) }; |