From b904681b9b417220e5e350f935b70a98f15ba41c Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Thu, 4 May 2023 00:13:05 -0400 Subject: debug issue with projectile forces --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 43 ++++++++++++---------- .../nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 15 +++++--- 2 files changed, 32 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index b24591a0d..7efb8b73a 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -111,7 +111,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { @@ -237,7 +240,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.changeWedgeBasedOnNewAngle(val); this.updateReviewForcesBasedOnAngle(val); @@ -1785,7 +1788,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent {this.dataDoc.simulationPaused && this.dataDoc.simulationType != "Circular Motion" && ( @@ -1797,7 +1800,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.resetAll = (!this.dataDoc.resetAll); }} @@ -1813,7 +1816,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.resetAll = (!this.dataDoc.resetAll); }} @@ -1829,7 +1832,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.resetAll = (!this.dataDoc.resetAll); }} @@ -1845,7 +1848,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.resetAll = (!this.dataDoc.resetAll); }} @@ -1859,9 +1862,9 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.resetAll = (!this.dataDoc.resetAll); }} @@ -1882,7 +1885,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.simulationReset(!this.dataDoc.simulationReset); }} @@ -1898,7 +1901,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.simulationReset = (!this.dataDoc.simulationReset); }} @@ -1918,7 +1921,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.startPosY = (this.dataDoc.springRestLength + val); this.dataDoc.springStartLength = (this.dataDoc.springRestLength + val); @@ -1940,7 +1943,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.changeWedgeBasedOnNewAngle(val); this.dataDoc.simulationReset = (!this.dataDoc.simulationReset); @@ -1961,7 +1964,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.updateForcesWithFriction(val); if (val < Number(this.dataDoc.coefficientOfKineticFriction)) { @@ -1984,7 +1987,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.simulationReset = (!this.dataDoc.simulationReset); }} @@ -2022,7 +2025,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.startPendulumAngle = (value); if (this.dataDoc.simulationType == "Pendulum") { diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index b973d30c8..7407d6fa6 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -919,6 +919,7 @@ export default class Weight extends React.Component { className="weightContainer" onPointerDown={(e) => { if (this.draggable) { + console.log('dragging = true') this.props.dataDoc['paused'] = true; this.setState({dragging: true}); this.setState({clickPositionX: e.clientX}); @@ -927,6 +928,7 @@ export default class Weight extends React.Component { }} onPointerMove={(e) => { if (this.state.dragging) { + console.log('dragging') let newY = this.state.yPosition + e.clientY - this.state.clickPositionY; if (newY > this.props.yMax - 2 * this.props.radius - 10) { newY = this.props.yMax - 2 * this.props.radius - 10; @@ -968,6 +970,7 @@ export default class Weight extends React.Component { }} onPointerUp={(e) => { if (this.state.dragging) { + console.log('dragging = false') if ( this.props.dataDoc['simulationType'] != "Pendulum" && this.props.dataDoc['simulationType'] != "Suspension" @@ -1339,7 +1342,7 @@ export default class Weight extends React.Component { position: "absolute", left: this.state.xPosition + this.props.radius + this.state.xAccel * 3 + 25 + "px", top: this.state.yPosition + this.props.radius + this.state.yAccel * 3 + 70 + "px", - lineHeight: 0.5, + lineHeight: 1, }} >

@@ -1393,7 +1396,7 @@ export default class Weight extends React.Component { position: "absolute", left: this.state.xPosition + this.props.radius + this.state.xVelocity * 3 + 25 + "px", top: this.state.yPosition + this.props.radius + this.state.yVelocity * 3 + "px", - lineHeight: 0.5, + lineHeight: 1, }} >

@@ -1506,7 +1509,7 @@ export default class Weight extends React.Component { position: "absolute", left: labelLeft + "px", top: labelTop + "px", - lineHeight: 0.5, + lineHeight: 1, backgroundColor: this.labelBackgroundColor, }} > @@ -1519,7 +1522,7 @@ export default class Weight extends React.Component { ); })} - {/* {!this.state.dragging && + {!this.state.dragging && this.props.showForces && this.props.updatedForces && this.props.updatedForces.map((force, index) => { if (force.magnitude < this.epsilon) { @@ -1615,7 +1618,7 @@ export default class Weight extends React.Component { position: "absolute", left: labelLeft + "px", top: labelTop + "px", - lineHeight: 0.5, + lineHeight: 1, backgroundColor: this.labelBackgroundColor, }} > @@ -1627,7 +1630,7 @@ export default class Weight extends React.Component { ); - })} */} + })} )} }; -- cgit v1.2.3-70-g09d2