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 (
+
+ +
- ß - - + + + - - + + diff --git a/frontend/src/StepTimeTreadmill.css b/frontend/src/StepTimeTreadmill.css index a87e520..39ef8f2 100644 --- a/frontend/src/StepTimeTreadmill.css +++ b/frontend/src/StepTimeTreadmill.css @@ -1,18 +1,46 @@ .Treadmill { width: 70vw; - height: 85vh; - margin: 5vh 0; - background-color: grey; + height: 80vh; + margin: 1vh 0; + border-color: darkgray; + border-style: solid; + border-width: .25vw; + background-color: gray; } .Treadmill line { stroke-width: .02vw; } -.TargetZones line { +.TargetZones .max-zone { + stroke: blue; +} + +.TargetZones .min-zone { stroke: orange; } .StepTimeValues line { stroke: black; -} \ No newline at end of file +} + +.visual-key { + margin-top: 1vh; + padding: 0 0; + border-radius: 1vh; + border-color: white; +} + +.visual-key ul { + margin-top: .5vh; + list-style-type: none; + padding: .25vh .25vw; + margin: 0; +} + +.visual-key ul li { + font-size: 1vw; + padding: .25vh 0; + text-align:left; +} + \ No newline at end of file diff --git a/frontend/src/useStepTime.js b/frontend/src/useStepTime.js index 3c58237..6ba3c95 100644 --- a/frontend/src/useStepTime.js +++ b/frontend/src/useStepTime.js @@ -3,11 +3,11 @@ import { useState, useEffect } from 'react'; function useStepTime() { // TODO: update default values, check w/ line 14 comment const [stepTime, setStepTime] = useState({ - left: 27, - right: 30, + left: 0, + right: 0, targetZones: { - left: { min: 25, max: 35 }, - right: { min: 25, max: 35 } + left: { min: 0, max: 0 }, + right: { min: 0, max: 0 } } });