diff options
author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-03 16:04:02 -0400 |
---|---|---|
committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-03 16:04:02 -0400 |
commit | 2e3df73d84228b04b8d1f284b5e18f7e48fad759 (patch) | |
tree | 9628abbbe9e86cc0ce15f7b9c6fcac2145daa0cd /src | |
parent | 018077581b70483ac2f3453ba813b5f4adb61fd5 (diff) |
debugging json import
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx | 22 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 10 |
2 files changed, 14 insertions, 18 deletions
diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 315e64e79..056f79368 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -33,8 +33,8 @@ import { import Typography from "@mui/material/Typography"; import "./PhysicsSimulationBox.scss"; import InputField from "./PhysicsSimulationInputField"; -import questions from "./PhysicsSimulationQuestions.json"; -import tutorials from "./PhysicsSimulationTutorial.json"; +import * as questions from "./PhysicsSimulationQuestions.json"; +import * as tutorials from "./PhysicsSimulationTutorial.json"; import Wall from "./PhysicsSimulationWall"; import Weight from "./PhysicsSimulationWeight"; @@ -108,9 +108,9 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi componentDidMount() { // Used throughout sims this.layoutDoc._width = 1000; - this.layoutDoc._height = 1000; - this.xMax = this.layoutDoc._width*0.7 ?? 700; - this.yMax = this.layoutDoc._height*0.7 ?? 700; + this.layoutDoc._height = 800; + this.xMax = this.layoutDoc._width*0.7; + this.yMax = this.layoutDoc._height*0.9; this.radius = 50; this.dataDoc.reviewCoefficient = this.dataDoc.reviewCoefficient ?? 0; this.dataDoc.questionVariables = this.dataDoc.questionVariables ?? []; @@ -147,7 +147,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi this.dataDoc.velocityYDisplay = this.dataDoc.velocityYDisplay ?? 0; // Used for review mode - // this.dataDoc.answerInputFields = this.dataDoc.answerInputFields ?? <div></div>; + this.dataDoc.answerInputFields = this.dataDoc.answerInputFields ?? <div></div>; // this.dataDoc.currentForceSketch = this.dataDoc.currentForceSketch ?? null; // this.dataDoc.deleteMode = this.dataDoc.deleteMode ?? false; // this.dataDoc.forceSketches = this.dataDoc.forceSketches ?? []; @@ -163,11 +163,11 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi this.dataDoc.reviewStaticAngle = this.dataDoc.reviewStaticAngle ?? 0; this.dataDoc.reviewStaticMagnitude = this.dataDoc.reviewStaticMagnitude ?? 0; this.dataDoc.selectedSolutions = this.dataDoc.selectedSolutions ?? []; - // this.dataDoc.selectedQuestion = this.dataDoc.selectedQuestion ?? questions.inclinePlane[0]; + this.dataDoc.selectedQuestion = this.dataDoc.selectedQuestion ?? questions.inclinePlane[0]; // this.dataDoc.sketching = this.dataDoc.sketching ?? false; - // // Used for tutorial mode - // this.dataDoc.selectedTutorial = this.dataDoc.selectedTutorial ?? tutorials.inclinePlane; + // Used for tutorial mode + this.dataDoc.selectedTutorial = this.dataDoc.selectedTutorial ?? tutorials.inclinePlane; // Used for uniform circular motion this.dataDoc.circularMotionRadius = this.dataDoc.circularMotionRadius ?? 150; @@ -217,8 +217,8 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi } componentDidUpdate() { - this.xMax = this.layoutDoc._width*0.7 ?? 700; - this.yMax = this.layoutDoc._height*0.7 ?? 700; + this.xMax = this.layoutDoc._width*0.7; + this.yMax = this.layoutDoc._height*0.9; this.radius = 0.05*this.layoutDoc._height ?? 50; } diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index 597256d44..8369a994a 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -244,7 +244,6 @@ export default class Weight extends React.Component<IWeightProps, IState> { // // Make sure weight doesn't go above max height // if (prevState.updatedStartPosY != this.state.updatedStartPosY || prevProps.startVelY != this.props.startVelY) { - // console.log('max height check') // if (this.props.dataDoc['simulationType'] == "One Weight") { // let maxYPos = this.state.updatedStartPosY; // if (this.props.startVelY != 0) { @@ -258,9 +257,9 @@ export default class Weight extends React.Component<IWeightProps, IState> { // } // Check for collisions and update + if (!this.props.paused) { if (prevState.timer != this.state.timer) { - console.log('update') - if (!this.props.paused && !this.props.noMovement) { + if (!this.props.noMovement) { let collisions = false; if ( this.props.dataDoc['simulationType'] == "One Weight" || @@ -281,16 +280,15 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setDisplayValues(); } } + } // Reset everything on reset button click if (prevProps.reset != this.props.reset) { - console.log('reset') this.resetEverything(); } // Convert from static to kinetic friction if/when weight slips on inclined plane if (prevState.xVelocity != this.state.xVelocity) { - console.log('friction') if ( this.props.dataDoc['simulationType'] == "Inclined Plane" && Math.abs(this.state.xVelocity) > 0.1 && @@ -407,7 +405,6 @@ export default class Weight extends React.Component<IWeightProps, IState> { // Add/remove walls when simulation type changes if (prevProps.simulationType != this.props.simulationType) { - console.log('walls') let w: IWallProps[] = []; if (this.props.dataDoc['simulationType'] == "One Weight" || this.props.dataDoc['simulationType'] == "Inclined Plane") { w = this.props.wallPositions @@ -440,7 +437,6 @@ export default class Weight extends React.Component<IWeightProps, IState> { const coordinatePair2 = Math.round(left + this.props.wedgeWidth) + "," + this.props.yMax + " "; const coordinatePair3 = Math.round(left) + "," + (this.props.yMax - this.props.wedgeHeight); const coord = coordinatePair1 + coordinatePair2 + coordinatePair3; - console.log('coord ', coord) this.setState({coordinates: coord}) } |