From 09f61f8d1e10de81f6f5d18ff372744715aa62c4 Mon Sep 17 00:00:00 2001 From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> Date: Thu, 4 May 2023 21:16:36 -0400 Subject: debug wrong start values for input fields --- .../PhysicsBox/PhysicsSimulationInputField.tsx | 5 ++- .../nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 45 +++++++++++----------- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx index 3386bfd1c..353b386a6 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx @@ -37,12 +37,15 @@ export default class InputField extends React.Component { tempRadianValue: this.props.mode != "Freeform" && !this.props.showIcon ? 0 : (Number(this.props.value) * Math.PI) / 180, width: this.props.small ? "6em" : "7em", margin: this.props.small ? "0px" : "10px" - } } epsilon: number = 0.01; + componentDidMount(): void { + this.setState({tempValue: Number(this.props.value)}) + } + componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { if (prevProps.value != this.props.value && !isNaN(this.props.value)) { if (this.props.mode == "Freeform") { diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index 30c78cd94..a571f03f7 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -1130,9 +1130,10 @@ export default class Weight extends React.Component { )} + {this.props.dataDoc['simulationType'] == "Pulley" && (
{ }} > -
)} {this.props.dataDoc['simulationType'] == "Pulley" && (
{ }} > -
@@ -1369,8 +1370,8 @@ export default class Weight extends React.Component { { style={{ pointerEvents: "none", position: "absolute", - left: this.state.xPosition + this.props.radius + this.state.xAccel * 3 + 25 + "px", - top: this.state.yPosition + this.props.radius + this.state.yAccel * 3 + 70 + "px", + left: this.state.xPosition + this.props.radius + this.state.xAccel * 15 + 25 + "px", + top: this.state.yPosition + this.props.radius + this.state.yAccel * 15 + 70 + "px", lineHeight: 1, }} > @@ -1423,8 +1424,8 @@ export default class Weight extends React.Component { { style={{ pointerEvents: "none", position: "absolute", - left: this.state.xPosition + this.props.radius + this.state.xVelocity * 3 + 25 + "px", - top: this.state.yPosition + this.props.radius + this.state.yVelocity * 3 + "px", + left: this.state.xPosition + this.props.radius + this.state.xVelocity * 7 + 25 + "px", + top: this.state.yPosition + this.props.radius + this.state.yVelocity * 7 + "px", lineHeight: 1, }} > -- cgit v1.2.3-70-g09d2