diff --git a/frontend/src/StepTimeTreadmil.js b/frontend/src/StepTimeTreadmil.js
index 994544f..bb84ec0 100644
--- a/frontend/src/StepTimeTreadmil.js
+++ b/frontend/src/StepTimeTreadmil.js
@@ -1,22 +1,38 @@
import "./StepTimeTreadmill.css"
function StepTimeTreadmill({ stepTime }) {
- const leftOffsetMin = (stepTime.left - stepTime.targetZones.left.min);
- const leftOffsetMax = (stepTime.left - stepTime.targetZones.left.max) * -1;
- const rightOffsetMin = (stepTime.right - stepTime.targetZones.right.min);
- const rightOffsetMax = (stepTime.right - stepTime.targetZones.right.max) * -1;
+ const scaleFactor = 50;
+ const leftScaleFactor = scaleFactor / stepTime.left;
+ const rightScaleFactor = scaleFactor / stepTime.right;
+ const leftOffsetMin = (stepTime.left - stepTime.targetZones.left.min) * -leftScaleFactor;
+ const leftOffsetMax = (stepTime.left - stepTime.targetZones.left.max) * leftScaleFactor;
+ const rightOffsetMin = (stepTime.right - stepTime.targetZones.right.min) * -rightScaleFactor;
+ const rightOffsetMax = (stepTime.right - stepTime.targetZones.right.max) * rightScaleFactor;
+ // Based on a 100x100 viewbox, ensures at least 1 target-zone is visible to imply that the other is too far
+ let leftMinPosition = Math.max(scaleFactor - leftOffsetMin, 0);
+ let leftMaxPosition = Math.min(scaleFactor + leftOffsetMax, 100);
+ let rightMinPositon = Math.max(scaleFactor - rightOffsetMin, 0);
+ let rightMaxPosition = Math.min(scaleFactor + rightOffsetMax, 100);
+
return (
+
+
+
Key
+
Vertical Lines: The blue line represents the upper echlon of the target zone and the orange line represents the bottom line of the target zone for left and right target zones respectively.
+
X's: The left and right x's represent the left and right current step time respectively.