From 018077581b70483ac2f3453ba813b5f4adb61fd5 Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Wed, 3 May 2023 13:06:09 -0400 Subject: debugging --- .../views/nodes/PhysicsBox/PhysicsSimulationBox.tsx | 15 ++++++++++----- .../views/nodes/PhysicsBox/PhysicsSimulationWall.tsx | 4 ++-- .../views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 15 +++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 9a16c5c73..315e64e79 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -106,11 +106,6 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { } wallStyle = { - width: this.props.angleInDegrees == 0 ? this.props.length + "%" : "1%", - height: this.props.angleInDegrees == 0 ? "1%" : this.props.length + "%", + width: this.props.angleInDegrees == 0 ? this.props.length + "%" : "5px", + height: this.props.angleInDegrees == 0 ? "5px" : this.props.length + "%", position: "absolute" as "absolute", left: this.props.xPos + "%", top: this.props.yPos + "%", 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 { 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 { // 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, -- cgit v1.2.3-70-g09d2