From 26af8ab71bec926e4514c7df2d523f1635f55f9b Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 23 May 2023 15:59:44 -0400 Subject: fixed resizing physbox container. --- .../nodes/PhysicsBox/PhysicsSimulationBox.tsx | 138 ++++++++++----------- 1 file changed, 63 insertions(+), 75 deletions(-) (limited to 'src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx') diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx index eb41e0de8..bb41cd72e 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx @@ -76,10 +76,6 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - return this.yMax - yPos - 2 * (0.08 * this.layoutDoc[HeightSym]()) + 5; + return this.yMax - yPos - 2 * (0.08 * this.props.PanelHeight()) + 5; }; getYPosFromDisplay = (yDisplay: number) => { - return this.yMax - yDisplay - 2 * (0.08 * this.layoutDoc[HeightSym]()) + 5; + return this.yMax - yDisplay - 2 * (0.08 * this.props.PanelHeight()) + 5; }; // Update forces when coefficient of static friction changes in freeform mode @@ -442,27 +430,27 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent= 5 && angle < 10) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.1; + yPos += 0.08 * this.props.PanelHeight() * 0.1; } else if (angle >= 10 && angle < 15) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.23; + yPos += 0.08 * this.props.PanelHeight() * 0.23; } else if (angle >= 15 && angle < 20) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.26; + yPos += 0.08 * this.props.PanelHeight() * 0.26; } else if (angle >= 20 && angle < 25) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.33; + yPos += 0.08 * this.props.PanelHeight() * 0.33; } else if (angle >= 25 && angle < 30) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.35; + yPos += 0.08 * this.props.PanelHeight() * 0.35; } else if (angle >= 30 && angle < 35) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.4; + yPos += 0.08 * this.props.PanelHeight() * 0.4; } else if (angle >= 35 && angle < 40) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.45; + yPos += 0.08 * this.props.PanelHeight() * 0.45; } else if (angle >= 40 && angle < 45) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.47; + yPos += 0.08 * this.props.PanelHeight() * 0.47; } else if (angle >= 45) { - yPos += 0.08 * this.layoutDoc[HeightSym]() * 0.52; + yPos += 0.08 * this.props.PanelHeight() * 0.52; } this.dataDoc.mass1_positionXstart = this.xMax * 0.25; @@ -692,8 +680,8 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { - let xPos = (this.xMax + this.xMin) / 2 - 0.08 * this.layoutDoc[HeightSym](); + let xPos = (this.xMax + this.xMin) / 2 - 0.08 * this.props.PanelHeight(); let yPos = this.yMin + 200; this.dataDoc.mass1_positionYstart = yPos; this.dataDoc.mass1_positionXstart = xPos; @@ -822,9 +810,9 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent { this.dataDoc.simulation_showComponentForces = false; this.dataDoc.mass1_positionYstart = (this.yMax + this.yMin) / 2; - this.dataDoc.mass1_positionXstart = (this.xMin + this.xMax) / 2 - 2 * (0.08 * this.layoutDoc[HeightSym]()) - 5; + this.dataDoc.mass1_positionXstart = (this.xMin + this.xMax) / 2 - 2 * (0.08 * this.props.PanelHeight()) - 5; this.dataDoc.mass1_positionY = this.getDisplayYPos((this.yMax + this.yMin) / 2); - this.dataDoc.mass1_positionX = (this.xMin + this.xMax) / 2 - 2 * (0.08 * this.layoutDoc[HeightSym]()) - 5; + this.dataDoc.mass1_positionX = (this.xMin + this.xMax) / 2 - 2 * (0.08 * this.props.PanelHeight()) - 5; let a = (-1 * ((this.mass1 - this.mass2) * Math.abs(this.gravity))) / (this.mass1 + this.mass2); const gravityForce1: IForce = { description: 'Gravity', @@ -938,8 +926,8 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent @@ -1138,8 +1126,8 @@ export class PhysicsSimulationBox extends ViewBoxAnnotatableComponent
-

{StrCast(this.dataDoc.questionPartOne)}

-

{StrCast(this.dataDoc.questionPartTwo)}

+

{this.questionPartOne}

+

{this.questionPartTwo}

{this.selectedQuestion.answerParts.includes('force of gravity') && ( -- cgit v1.2.3-70-g09d2