aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx')
-rw-r--r--src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx
index c0bcd783a..597256d44 100644
--- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx
+++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx
@@ -3,6 +3,12 @@ import React = require('react');
import { IWallProps } from "./PhysicsSimulationWall";
import "./PhysicsSimulationBox.scss";
+interface IWallProps {
+ length: number;
+ xPos: number;
+ yPos: number;
+ angleInDegrees: number;
+}
interface IForce {
description: string;
magnitude: number;
@@ -48,6 +54,7 @@ export interface IWeightProps {
timestepSize: number;
updateDisplay: { xDisplay: number; yDisplay: number };
updatedForces: IForce[];
+ wallPositions: IWallProps[];
wedgeHeight: number;
wedgeWidth: number;
xMax: number;
@@ -403,10 +410,7 @@ export default class Weight extends React.Component<IWeightProps, IState> {
console.log('walls')
let w: IWallProps[] = [];
if (this.props.dataDoc['simulationType'] == "One Weight" || this.props.dataDoc['simulationType'] == "Inclined Plane") {
- w.push({ length: 70, xPos: 0, yPos: 0, angleInDegrees: 0 });
- w.push({ length: 70, xPos: 0, yPos: 70, angleInDegrees: 0 });
- w.push({ length: 70, xPos: 0, yPos: 0, angleInDegrees: 90 });
- w.push({ length: 70, xPos: 69.5, yPos: 0, angleInDegrees: 90 });
+ w = this.props.wallPositions
}
this.setState({walls: w})
}
@@ -431,17 +435,16 @@ export default class Weight extends React.Component<IWeightProps, IState> {
// Update wedge coordinates
if (prevProps.wedgeWidth != this.props.wedgeWidth || prevProps.wedgeHeight != this.props.wedgeHeight) {
- console.log('wedge')
const left = this.props.xMax * 0.5 - 200;
const coordinatePair1 = Math.round(left) + "," + this.props.yMax + " ";
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})
}
if (this.state.xPosition != prevState.xPosition || this.state.yPosition != prevState.yPosition) {
- console.log('style')
this.weightStyle = {
alignItems: "center",
backgroundColor: this.props.color,