diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx | 5 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 45 |
2 files changed, 27 insertions, 23 deletions
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<IInputProps, IState> { 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<IInputProps>, prevState: Readonly<IState>, 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<IWeightProps, IState> { </svg> </div> )} + {this.props.dataDoc['simulationType'] == "Pulley" && ( <div - className="wheel" + className="rod" style={{ pointerEvents: "none", position: "absolute", @@ -1141,18 +1142,20 @@ export default class Weight extends React.Component<IWeightProps, IState> { }} > <svg width={this.props.xMax + "px"} height={this.props.layoutDoc._height + "px"}> - <circle - cx={(this.props.xMax + this.props.xMin) / 2} - cy={this.props.radius} - r={this.props.radius * 1.5} - fill={"#808080"} + <line + x1={this.state.xPosition + this.props.radius} + y1={this.state.yPosition + this.props.radius} + x2={this.state.xPosition + this.props.radius} + y2={this.props.yMin} + stroke={"#deb887"} + strokeWidth="10" /> </svg> </div> )} {this.props.dataDoc['simulationType'] == "Pulley" && ( <div - className="rod" + className="wheel" style={{ pointerEvents: "none", position: "absolute", @@ -1161,13 +1164,11 @@ export default class Weight extends React.Component<IWeightProps, IState> { }} > <svg width={this.props.xMax + "px"} height={this.props.layoutDoc._height + "px"}> - <line - x1={this.state.xPosition + this.props.radius} - y1={this.state.yPosition + this.props.radius} - x2={this.state.xPosition + this.props.radius} - y2={this.props.yMin} - stroke={"#deb887"} - strokeWidth="10" + <circle + cx={(this.props.xMax + this.props.xMin) / 2} + cy={this.props.radius} + r={this.props.radius * 1.5} + fill={"#808080"} /> </svg> </div> @@ -1369,8 +1370,8 @@ export default class Weight extends React.Component<IWeightProps, IState> { <line x1={this.state.xPosition + this.props.radius} y1={this.state.yPosition + this.props.radius} - x2={this.state.xPosition + this.props.radius + this.getNewAccelerationX(this.props.updatedForces) * 7} - y2={this.state.yPosition + this.props.radius + this.getNewAccelerationY(this.props.updatedForces) * 7} + x2={this.state.xPosition + this.props.radius + this.getNewAccelerationX(this.props.updatedForces) * 15} + y2={this.state.yPosition + this.props.radius + this.getNewAccelerationY(this.props.updatedForces) * 15} stroke={"green"} strokeWidth="5" markerEnd="url(#accArrow)" @@ -1380,8 +1381,8 @@ export default class Weight extends React.Component<IWeightProps, IState> { 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<IWeightProps, IState> { <line x1={this.state.xPosition + this.props.radius} y1={this.state.yPosition + this.props.radius} - x2={this.state.xPosition + this.props.radius + this.state.xVelocity * 3} - y2={this.state.yPosition + this.props.radius + this.state.yVelocity * 3} + x2={this.state.xPosition + this.props.radius + this.state.xVelocity * 7} + y2={this.state.yPosition + this.props.radius + this.state.yVelocity * 7} stroke={"blue"} strokeWidth="5" markerEnd="url(#velArrow)" @@ -1434,8 +1435,8 @@ export default class Weight extends React.Component<IWeightProps, IState> { 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, }} > |