aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PhysicsSimulationWeight.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/PhysicsSimulationWeight.tsx')
-rw-r--r--src/client/views/nodes/PhysicsSimulationWeight.tsx160
1 files changed, 80 insertions, 80 deletions
diff --git a/src/client/views/nodes/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsSimulationWeight.tsx
index 9aa5a6aab..39b3249e8 100644
--- a/src/client/views/nodes/PhysicsSimulationWeight.tsx
+++ b/src/client/views/nodes/PhysicsSimulationWeight.tsx
@@ -518,86 +518,86 @@ export default class Weight extends React.Component<IWeightProps, IState> {
<div>
<div
className="weightContainer"
- onPointerDown={(e) => {
- if (this.draggable) {
- e.preventDefault();
- this.props.dataDoc['simulationPaused'] = true;
- this.setState({dragging: true});
- this.setState({clickPositionX: e.clientX})
- this.setState({clickPositionY: e.clientY})
- }
- }}
- onPointerMove={(e) => {
- e.preventDefault();
- if (this.state.dragging) {
- let newY = this.state.yPosition + e.clientY - this.state.clickPositionY;
- if (newY > this.props.yMax - 2 * this.props.radius) {
- newY = this.props.yMax - 2 * this.props.radius;
- }
-
- let newX = this.state.xPosition + e.clientX - this.state.clickPositionX;
- if (newX > this.props.xMax - 2 * this.props.radius) {
- newX = this.props.xMax - 2 * this.props.radius;
- } else if (newX < 0) {
- newX = 0;
- }
- this.setState({xPosition: newX})
- this.setState({yPosition: newY})
- this.setState({updatedStartPosX: newX})
- this.setState({updatedStartPosY: newY})
- this.props.dataDoc['positionYDisplay'] = Math.round((this.props.yMax - 2 * this.props.radius - newY + 5) * 100) / 100;
- this.setState({clickPositionX: e.clientX})
- this.setState({clickPositionY: e.clientY})
- this.setDisplayValues();
- }
- }}
- onPointerUp={(e) => {
- if (this.state.dragging) {
- e.preventDefault();
- if (!this.props.dataDoc['pendulum']) {
- this.resetEverything();
- }
- this.setState({dragging: false});
- let newY = this.state.yPosition + e.clientY - this.state.clickPositionY;
- if (newY > this.props.yMax - 2 * this.props.radius) {
- newY = this.props.yMax - 2 * this.props.radius;
- }
-
- let newX = this.state.xPosition + e.clientX - this.state.clickPositionX;
- if (newX > this.props.xMax - 2 * this.props.radius) {
- newX = this.props.xMax - 2 * this.props.radius;
- } else if (newX < 0) {
- newX = 0;
- }
- if (this.props.dataDoc['pendulum']) {
- const x = this.props.xMax / 2 - newX - this.props.radius;
- const y = newY + this.props.radius + 5;
- let angle = (Math.atan(y / x) * 180) / Math.PI;
- if (angle < 0) {
- angle += 180;
- }
- let oppositeAngle = 90 - angle;
- if (oppositeAngle < 0) {
- oppositeAngle = 90 - (180 - angle);
- }
-
- const pendulumLength = Math.sqrt(x * x + y * y);
- this.props.dataDoc['pendulumAngle'] = oppositeAngle;
- this.props.dataDoc['pendulumLength'] = Math.sqrt(x * x + y * y);
- const mag = 9.81 * Math.cos((oppositeAngle * Math.PI) / 180);
- const forceOfTension: IForce = {
- description: "Tension",
- magnitude: mag,
- directionInDegrees: angle,
- };
- this.setState({kineticFriction: false})
- this.setState({xVelocity: this.props.startVelX ?? 0})
- this.setState({yVelocity: this.props.startVelY ?? 0})
- this.setDisplayValues();
- this.props.dataDoc['updatedForces'] = ([this.forceOfGravity, forceOfTension]);
- }
- }
- }}
+ // onPointerDown={(e) => {
+ // if (this.draggable) {
+ // e.preventDefault();
+ // this.props.dataDoc['simulationPaused'] = true;
+ // this.setState({dragging: true});
+ // this.setState({clickPositionX: e.clientX})
+ // this.setState({clickPositionY: e.clientY})
+ // }
+ // }}
+ // onPointerMove={(e) => {
+ // e.preventDefault();
+ // if (this.state.dragging) {
+ // let newY = this.state.yPosition + e.clientY - this.state.clickPositionY;
+ // if (newY > this.props.yMax - 2 * this.props.radius) {
+ // newY = this.props.yMax - 2 * this.props.radius;
+ // }
+
+ // let newX = this.state.xPosition + e.clientX - this.state.clickPositionX;
+ // if (newX > this.props.xMax - 2 * this.props.radius) {
+ // newX = this.props.xMax - 2 * this.props.radius;
+ // } else if (newX < 0) {
+ // newX = 0;
+ // }
+ // this.setState({xPosition: newX})
+ // this.setState({yPosition: newY})
+ // this.setState({updatedStartPosX: newX})
+ // this.setState({updatedStartPosY: newY})
+ // this.props.dataDoc['positionYDisplay'] = Math.round((this.props.yMax - 2 * this.props.radius - newY + 5) * 100) / 100;
+ // this.setState({clickPositionX: e.clientX})
+ // this.setState({clickPositionY: e.clientY})
+ // this.setDisplayValues();
+ // }
+ // }}
+ // onPointerUp={(e) => {
+ // if (this.state.dragging) {
+ // e.preventDefault();
+ // if (!this.props.dataDoc['pendulum']) {
+ // this.resetEverything();
+ // }
+ // this.setState({dragging: false});
+ // let newY = this.state.yPosition + e.clientY - this.state.clickPositionY;
+ // if (newY > this.props.yMax - 2 * this.props.radius) {
+ // newY = this.props.yMax - 2 * this.props.radius;
+ // }
+
+ // let newX = this.state.xPosition + e.clientX - this.state.clickPositionX;
+ // if (newX > this.props.xMax - 2 * this.props.radius) {
+ // newX = this.props.xMax - 2 * this.props.radius;
+ // } else if (newX < 0) {
+ // newX = 0;
+ // }
+ // if (this.props.dataDoc['pendulum']) {
+ // const x = this.props.xMax / 2 - newX - this.props.radius;
+ // const y = newY + this.props.radius + 5;
+ // let angle = (Math.atan(y / x) * 180) / Math.PI;
+ // if (angle < 0) {
+ // angle += 180;
+ // }
+ // let oppositeAngle = 90 - angle;
+ // if (oppositeAngle < 0) {
+ // oppositeAngle = 90 - (180 - angle);
+ // }
+
+ // const pendulumLength = Math.sqrt(x * x + y * y);
+ // this.props.dataDoc['pendulumAngle'] = oppositeAngle;
+ // this.props.dataDoc['pendulumLength'] = Math.sqrt(x * x + y * y);
+ // const mag = 9.81 * Math.cos((oppositeAngle * Math.PI) / 180);
+ // const forceOfTension: IForce = {
+ // description: "Tension",
+ // magnitude: mag,
+ // directionInDegrees: angle,
+ // };
+ // this.setState({kineticFriction: false})
+ // this.setState({xVelocity: this.props.startVelX ?? 0})
+ // this.setState({yVelocity: this.props.startVelY ?? 0})
+ // this.setDisplayValues();
+ // this.props.dataDoc['updatedForces'] = ([this.forceOfGravity, forceOfTension]);
+ // }
+ // }
+ // }}
>
<div className="weight" style={this.weightStyle}>
<p className="weightLabel">{this.props.mass} kg</p>