aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/nodes/PhysicsBox/PhysicsSimulationBox.tsx22
1 files changed, 18 insertions, 4 deletions
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(