diff options
author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-01 21:02:27 -0400 |
---|---|---|
committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-01 21:02:27 -0400 |
commit | d2e56061dd9cb7913ede040e7d16aa451e39adc0 (patch) | |
tree | 88b697f85dad43d3fde25708f94505ee5d8557fd /src | |
parent | cb55cf455ef4b4e2acc0e1e54cb1be99c131b967 (diff) |
something appears
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 4 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx | 4 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 164 |
3 files changed, 86 insertions, 86 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 31c8a7890..0f3d5867e 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -661,7 +661,7 @@ export namespace Docs { DocumentType.SIMULATION, { layout: { view: PhysicsSimulationBox, dataField: defaultDataKey }, - options: { _height: 150 } + options: { _height: 500 } } ] ]); @@ -669,7 +669,7 @@ export namespace Docs { const suffix = 'Proto'; /** - * This function loads or initializes the prototype for each docment type. + * This function loads or initializes the prototype for each document type. * * This is an asynchronous function because it has to attempt * to fetch the prototype documents from the server. diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index 91627687a..21cef297a 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -1298,7 +1298,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi </div> </div> <div className="mechanicsSimulationElements"> - {/* <Weight + <Weight dataDoc={this.dataDoc} layoutDoc={this.layoutDoc} adjustPendulumAngle={this.dataDoc.adjustPendulumAngle} @@ -1345,7 +1345,7 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi xMin={this.xMin} yMax={this.yMax} yMin={this.yMin} - /> */} + /> {this.dataDoc.simulationType == "Pulley" && ( <Weight dataDoc={this.dataDoc} diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index c25cb9985..192ff1d04 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -194,39 +194,39 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.props.dataDoc['pendulumLength'] = this.props.adjustPendulumAngle.length } - // When display values updated by user, update real values - if (prevProps.updateDisplay != this.props.updateDisplay) { - if (this.props.updateDisplay.xDisplay != this.state.xPosition) { - let x = this.props.updateDisplay.xDisplay; - x = Math.max(0, x); - x = Math.min(x, this.props.xMax - 2 * this.props.radius); - this.setState({updatedStartPosX: x}) - this.setState({xPosition: x}) - this.props.dataDoc['positionXDisplay'] = x - } + // // When display values updated by user, update real values + // if (prevProps.updateDisplay != this.props.updateDisplay) { + // if (this.props.updateDisplay.xDisplay != this.state.xPosition) { + // let x = this.props.updateDisplay.xDisplay; + // x = Math.max(0, x); + // x = Math.min(x, this.props.xMax - 2 * this.props.radius); + // this.setState({updatedStartPosX: x}) + // this.setState({xPosition: x}) + // this.props.dataDoc['positionXDisplay'] = x + // } - if (this.props.updateDisplay.yDisplay != this.getDisplayYPos(this.state.yPosition)) { - let y = this.props.updateDisplay.yDisplay; - y = Math.max(0, y); - y = Math.min(y, this.props.yMax - 2 * this.props.radius); - let coordinatePosition = this.getYPosFromDisplay(y); - this.setState({updatedStartPosY: coordinatePosition}) - this.setState({yPosition: coordinatePosition}) - this.props.dataDoc['positionYDisplay'] = y - } + // if (this.props.updateDisplay.yDisplay != this.getDisplayYPos(this.state.yPosition)) { + // let y = this.props.updateDisplay.yDisplay; + // y = Math.max(0, y); + // y = Math.min(y, this.props.yMax - 2 * this.props.radius); + // let coordinatePosition = this.getYPosFromDisplay(y); + // this.setState({updatedStartPosY: coordinatePosition}) + // this.setState({yPosition: coordinatePosition}) + // this.props.dataDoc['positionYDisplay'] = y + // } - if (this.props.displayXVelocity != this.state.xVelocity) { - let x = this.props.displayXVelocity; - this.setState({xVelocity: x}) - this.props.dataDoc['velocityXDisplay'] = x - } + // if (this.props.displayXVelocity != this.state.xVelocity) { + // let x = this.props.displayXVelocity; + // this.setState({xVelocity: x}) + // this.props.dataDoc['velocityXDisplay'] = x + // } - if (this.props.displayYVelocity != -this.state.yVelocity) { - let y = this.props.displayYVelocity; - this.setState({yVelocity: -y}) - this.props.dataDoc['velocityYDisplay'] = y - } - } + // if (this.props.displayYVelocity != -this.state.yVelocity) { + // let y = this.props.displayYVelocity; + // this.setState({yVelocity: -y}) + // this.props.dataDoc['velocityYDisplay'] = y + // } + // } // Prevent bug when switching between sims if (prevProps.startForces != this.props.startForces) { @@ -235,43 +235,43 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setDisplayValues(); } - // Make sure weight doesn't go above max height - if (prevState.updatedStartPosY != this.state.updatedStartPosY || prevProps.startVelY != this.props.startVelY) { - if (this.props.dataDoc['simulationType'] == "One Weight") { - let maxYPos = this.state.updatedStartPosY; - if (this.props.startVelY != 0) { - maxYPos -= (this.props.startVelY * this.props.startVelY) / (2 * Math.abs(this.props.gravity)); - } - if (maxYPos < 0) { - maxYPos = 0; - } - this.setState({maxPosYConservation: maxYPos}) - } - } + // // Make sure weight doesn't go above max height + // if (prevState.updatedStartPosY != this.state.updatedStartPosY || prevProps.startVelY != this.props.startVelY) { + // if (this.props.dataDoc['simulationType'] == "One Weight") { + // let maxYPos = this.state.updatedStartPosY; + // if (this.props.startVelY != 0) { + // maxYPos -= (this.props.startVelY * this.props.startVelY) / (2 * Math.abs(this.props.gravity)); + // } + // if (maxYPos < 0) { + // maxYPos = 0; + // } + // this.setState({maxPosYConservation: maxYPos}) + // } + // } - // Check for collisions and update - if (prevState.timer != this.state.timer) { - if (!this.props.paused && !this.props.noMovement) { - let collisions = false; - if ( - this.props.dataDoc['simulationType'] == "One Weight" || - this.props.dataDoc['simulationType'] == "Inclined Plane" - ) { - const collisionsWithGround = this.checkForCollisionsWithGround(); - const collisionsWithWalls = this.checkForCollisionsWithWall(); - collisions = collisionsWithGround || collisionsWithWalls; - } - if (this.props.dataDoc['simulationType'] == "Pulley") { - if (this.state.yPosition <= this.props.yMin + 100 || this.state.yPosition >= this.props.yMax - 100) { - collisions = true; - } - } - if (!collisions) { - this.update(); - } - this.setDisplayValues(); - } - } + // // Check for collisions and update + // if (prevState.timer != this.state.timer) { + // if (!this.props.paused && !this.props.noMovement) { + // let collisions = false; + // if ( + // this.props.dataDoc['simulationType'] == "One Weight" || + // this.props.dataDoc['simulationType'] == "Inclined Plane" + // ) { + // const collisionsWithGround = this.checkForCollisionsWithGround(); + // const collisionsWithWalls = this.checkForCollisionsWithWall(); + // collisions = collisionsWithGround || collisionsWithWalls; + // } + // if (this.props.dataDoc['simulationType'] == "Pulley") { + // if (this.state.yPosition <= this.props.yMin + 100 || this.state.yPosition >= this.props.yMax - 100) { + // collisions = true; + // } + // } + // if (!collisions) { + // this.update(); + // } + // this.setDisplayValues(); + // } + // } // Reset everything on reset button click if (prevProps.reset != this.props.reset) { @@ -406,24 +406,24 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setState({walls: w}) } - // Update x position when start pos x changes - if (prevProps.startPosX != this.props.startPosX) { - if (this.props.paused) { - this.setState({xPosition: this.props.startPosX}) - this.setState({updatedStartPosX: this.props.startPosX}) - this.props.dataDoc['positionXDisplay'] = this.props.startPosX - } - } + // // Update x position when start pos x changes + // if (prevProps.startPosX != this.props.startPosX) { + // if (this.props.paused) { + // this.setState({xPosition: this.props.startPosX}) + // this.setState({updatedStartPosX: this.props.startPosX}) + // this.props.dataDoc['positionXDisplay'] = this.props.startPosX + // } + // } - // Update y position when start pos y changes - 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.props.startPosY - } - } + // // Update y position when start pos y changes + // 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.props.startPosY + // } + // } // Update wedge coordinates if (prevProps.wedgeWidth != this.props.wedgeWidth || prevProps.wedgeHeight != this.props.wedgeHeight) { |