From c93e1dc281c831ab08cf0ce29420df845323b0be Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Mon, 1 May 2023 20:05:49 -0400 Subject: debugging --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 86 +++++++++++++++------- .../PhysicsBox/PhysicsSimulationInputField.tsx | 11 ++- .../nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 2 +- 3 files changed, 68 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 671466261..56c61c4f1 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -38,7 +38,13 @@ import tutorials from "./PhysicsSimulationTutorial.json"; import Wall from "./PhysicsSimulationWall"; import IWall from "./PhysicsSimulationWall"; import Weight from "./PhysicsSimulationWeight"; -import IForce from "./PhysicsSimulationWeight"; + +interface IForce { + description: string; + magnitude: number; + directionInDegrees: number; + component: boolean; +} interface VectorTemplate { top: number; left: number; @@ -833,7 +839,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentGravity magnitude

} lowerBound={0} - changeValue={this.dataDoc.reviewGravityMagnitude} + dataDoc={this.dataDoc} + prop={'reviewGravityMagnitude'} step={0.1} unit={"N"} upperBound={50} @@ -851,7 +858,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentGravity angle

} lowerBound={0} - changeValue={this.dataDoc.reviewGravityAngle} + dataDoc={this.dataDoc} + prop={'reviewGravityAngle'} step={1} unit={"°"} upperBound={360} @@ -870,7 +878,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentNormal force magnitude

} lowerBound={0} - changeValue={this.dataDoc.reviewNormalMagnitude} + dataDoc={this.dataDoc} + prop={'reviewNormalMagnitude'} step={0.1} unit={"N"} upperBound={50} @@ -888,7 +897,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentNormal force angle

} lowerBound={0} - changeValue={this.dataDoc.reviewNormalAngle} + dataDoc={this.dataDoc} + prop={'reviewNormalAngle'} step={1} unit={"°"} upperBound={360} @@ -907,7 +917,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentStatic friction magnitude

} lowerBound={0} - changeValue={this.dataDoc.reviewStaticMagnitude} + dataDoc={this.dataDoc} + prop={'reviewStaticMagnitude'} step={0.1} unit={"N"} upperBound={50} @@ -925,7 +936,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentStatic friction angle

} lowerBound={0} - changeValue={this.dataDoc.reviewStaticAngle} + dataDoc={this.dataDoc} + prop={'reviewStaticAngle'} step={1} unit={"°"} upperBound={360} @@ -948,7 +960,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent } lowerBound={0} - changeValue={this.dataDoc.coefficientOfStaticFriction} + dataDoc={this.dataDoc} + prop={'coefficientOfStaticFriction'} step={0.1} unit={""} upperBound={1} @@ -966,7 +979,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentθ} lowerBound={0} - changeValue={this.dataDoc.qedgeAngle} + dataDoc={this.dataDoc} + prop={'wedgeAngle'} step={1} unit={"°"} upperBound={49} @@ -1756,7 +1770,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentSpeed} lowerBound={1} - changeValue={this.dataDoc.simulationSpeed} //TODO - deal with input field change value now that datadoc is being used! + dataDoc={this.dataDoc} + prop={'simulationSpeed'} step={1} unit={"x"} upperBound={10} @@ -1767,7 +1782,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentGravity} lowerBound={-30} - changeValue={this.dataDoc.gravity} + dataDoc={this.dataDoc} + prop={'gravity'} step={0.01} unit={"m/s2"} upperBound={0} @@ -1782,7 +1798,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentMass} lowerBound={1} - changeValue={this.dataDoc.mass} + dataDoc={this.dataDoc} + prop={'mass'} step={0.1} unit={"kg"} upperBound={5} @@ -1797,7 +1814,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentRed mass} lowerBound={1} - changeValue={this.dataDoc.mass} + dataDoc={this.dataDoc} + prop={'mass'} step={0.1} unit={"kg"} upperBound={5} @@ -1812,7 +1830,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentBlue mass} lowerBound={1} - changeValue={this.dataDoc.mass2} + dataDoc={this.dataDoc} + prop={'mass2'} step={0.1} unit={"kg"} upperBound={5} @@ -1827,7 +1846,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentRod length} lowerBound={100} - changeValue={this.dataDoc.circularMotionRadius} + dataDoc={this.dataDoc} + prop={'circularMotionRadius'} step={5} unit={"kg"} upperBound={250} @@ -1847,7 +1867,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentSpring stiffness } lowerBound={0.1} - changeValue={this.dataDoc.springConstant} + dataDoc={this.dataDoc} + prop={'springConstant'} step={1} unit={"N/m"} upperBound={500} @@ -1862,7 +1883,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentRest length} lowerBound={10} - changeValue={this.dataDoc.springRestLength} + dataDoc={this.dataDoc} + prop={'springRestLength'} step={100} unit={""} upperBound={500} @@ -1881,7 +1903,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent } lowerBound={-(this.dataDoc.springRestLength - 10)} - changeValue={(val: number) => {}} + dataDoc={this.dataDoc} + prop={""} step={10} unit={""} upperBound={this.dataDoc.springRestLength} @@ -1902,7 +1925,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentθ} lowerBound={0} - changeValue={this.dataDoc.wedgeAngle} + dataDoc={this.dataDoc} + prop={'wedgeAngle'} step={1} unit={"°"} upperBound={49} @@ -1922,7 +1946,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent } lowerBound={0} - changeValue={this.dataDoc.coefficientOfStaticFriction} + dataDoc={this.dataDoc} + prop={'coefficientOfStaticFriction'} step={0.1} unit={""} upperBound={1} @@ -1944,7 +1969,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent } lowerBound={0} - changeValue={this.dataDoc.coefficientOfKineticFriction} + dataDoc={this.dataDoc} + prop={'coefficientOfKineticFriction'} step={0.1} unit={""} upperBound={Number(this.dataDoc.coefficientOfStaticFriction)} @@ -1981,7 +2007,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentAngle} lowerBound={0} - changeValue={this.dataDoc.pendulumAngle} + dataDoc={this.dataDoc} + prop={'pendulumAngle'} step={1} unit={"°"} upperBound={59} @@ -2071,7 +2098,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponentRod length} lowerBound={0} - changeValue={this.dataDoc.pendulumLength} + dataDoc={this.dataDoc} + prop={'pendulumLength'} step={1} unit={"m"} upperBound={400} @@ -2134,7 +2162,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { } else if (value < this.props.lowerBound) { value = this.props.lowerBound; } - this.props.dataDoc[this.props.prop] = value + if (this.props.prop != "") { + this.props.dataDoc[this.props.prop] = value + } this.setState({tempValue: event.target.value == "" ? event.target.value : value}) this.setState({tempRadianValue: (value * Math.PI) / 180}) if (this.props.effect) { @@ -85,8 +87,9 @@ export default class InputField extends React.Component { value = 2 * Math.PI; } else if (value < 0) { value = 0; + }if (this.props.prop != "") { + this.props.dataDoc[this.props.prop] = (value * 180) / Math.PI } - this.props.dataDoc[this.props.prop] = (value * 180) / Math.PI this.setState({tempValue: (value * 180) / Math.PI}) this.setState({tempRadianValue: value}) if (this.props.effect) { @@ -95,6 +98,7 @@ export default class InputField extends React.Component { }; render () { + return (
{ /> )}
+ ) } }; diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index 8b7d4ed30..ed219652a 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -3,7 +3,7 @@ import React = require('react'); import { IWallProps } from "./PhysicsSimulationWall"; import "./PhysicsSimulationBox.scss"; -export interface IForce { +interface IForce { description: string; magnitude: number; directionInDegrees: number; -- cgit v1.2.3-70-g09d2