From e5439cac0d08f37b2a1ab4927d1739c171d771ff Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Tue, 2 May 2023 17:50:45 -0400 Subject: debugging --- .../nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index a5bd5a04e..38af55635 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -409,18 +409,19 @@ export default class Weight extends React.Component { // Update x position when start pos x changes if (prevProps.startPosX != this.props.startPosX) { if (this.props.paused) { + console.log('update start x to ', this.props.startPosX) this.setState({xPosition: this.props.startPosX}) this.setState({updatedStartPosX: this.props.startPosX}) - this.props.dataDoc['positionXDisplay'] = this.props.startPosX + this.setXPosDisplay(this.props.startPosX) } } - // Update y position when start pos y changes TODO debug + // // Update y position when start pos y changes TODO debug // if (prevProps.startPosY != this.props.startPosY) { // if (this.props.paused) { // this.setState({yPosition: this.props.startPosY}) // this.setState({updatedStartPosY: this.props.startPosY}) - // this.props.dataDoc['positionYDisplay'] = this.getDisplayYPos(this.props.startPosY) + // this.setYPosDisplay(this.props.startPosY) // } // } @@ -433,6 +434,25 @@ export default class Weight extends React.Component { const coord = coordinatePair1 + coordinatePair2 + coordinatePair3; this.setState({coordinates: coord}) } + + if (this.state.xPosition != prevState.xPosition || this.state.yPosition != prevState.yPosition) { + this.weightStyle = { + alignItems: "center", + backgroundColor: this.props.color, + borderColor: "black", + borderRadius: 50 + "%", + borderStyle: "solid", + display: "flex", + height: 2 * this.props.radius + "px", + justifyContent: "center", + left: this.state.xPosition + "px", + position: "absolute" as "absolute", + top: this.state.yPosition + "px", + touchAction: "none", + width: 2 * this.props.radius + "px", + zIndex: 5, + }; + } } // Reset simulation on reset button click @@ -890,7 +910,7 @@ export default class Weight extends React.Component { // Render weight, spring, rod(s), vectors render () { return ( -
+
{ @@ -1018,7 +1038,6 @@ export default class Weight extends React.Component { position: "absolute", left: 0, top: 0, - zIndex: -2, }} > @@ -1060,7 +1079,6 @@ export default class Weight extends React.Component { position: "absolute", left: 0, top: 0, - zIndex: -1, }} > @@ -1264,7 +1282,7 @@ export default class Weight extends React.Component { {this.props.dataDoc['simulationType'] == "Inclined Plane" && (
@@ -1274,7 +1292,6 @@ export default class Weight extends React.Component {