From d980b13b7e161b68af0eb0f47cdac63e891f86b5 Mon Sep 17 00:00:00 2001
From: brynnchernosky <56202540+brynnchernosky@users.noreply.github.com>
Date: Thu, 4 May 2023 11:30:17 -0400
Subject: adjust incline plane position

---
 .../nodes/PhysicsBox/PhysicsSimulationBox.tsx      | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 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 c7bf155cb..cf873da1d 100644
--- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx
+++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx
@@ -217,12 +217,12 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi
 
   componentDidUpdate() {
     if (this.xMax != this.layoutDoc._width*0.6 || this.yMax != this.layoutDoc._height*0.9) {
+      this.layoutDoc._width = Math.max(this.layoutDoc._width, 800)
+      this.layoutDoc._height = Math.max(this.layoutDoc._height, 600)
       this.xMax = this.layoutDoc._width*0.6;
       this.yMax = this.layoutDoc._height*0.9;
       this.setupSimulation(this.dataDoc.simulationType, this.dataDoc.mode)
-      console.log('reset sim')
     }
-    console.log('update')
   }
 
   setupSimulation = (simulationType: string, mode: string) => {
@@ -496,9 +496,23 @@ export default class PhysicsSimulationBox extends ViewBoxAnnotatableComponent<Fi
     this.dataDoc.wedgeHeight = Math.tan((angle * Math.PI) / 180) * this.xMax*0.5;
 
     // update weight position based on updated wedge width/height
-    let yPos = this.yMax - (0.08*this.layoutDoc._height*1.2) - Math.tan((angle * Math.PI) / 180) * this.xMax*0.5;
+    let yPos = this.yMax - (0.08*this.layoutDoc._height*2) - Math.tan((angle * Math.PI) / 180) * this.xMax*0.5;
+
+    // adjust y position
+    if (angle >= 5 && angle < 10) {
+      yPos += 0.08*this.layoutDoc._height*0.2
+    } else if (angle >= 10 && angle < 15) {
+      yPos += 0.08*this.layoutDoc._height*0.23
+    } else if (angle >= 15 && angle < 20) {
+      yPos += 0.08*this.layoutDoc._height*0.26
+    } else if (angle >= 20 && angle < 25) {
+      yPos += 0.08*this.layoutDoc._height*0.28
+    } else if (angle >=25 && angle < 40) {
+      yPos += 0.08*this.layoutDoc._height*0.3
+    } 
+    
     
-    this.dataDoc.startPosX = this.xMax*0.25;
+    this.dataDoc.startPosX = this.xMax*0.25-(0.08*this.layoutDoc._height);
     this.dataDoc.startPosY = yPos;
     if (this.dataDoc.mode == "Freeform") {
       this.updateForcesWithFriction(
-- 
cgit v1.2.3-70-g09d2

