diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-18 16:52:11 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:04 +0200 |
| commit | f8f617c97fcb2df3dbefc9527d974151e367cb60 (patch) | |
| tree | f6405aa54f73b66220f36e3a388725f71d023cfb /src/components/timeline/TimelineControlsComponent.js | |
| parent | 9f86ae6de969baa625e3341c796c64f63b5153ce (diff) | |
Implement basic experiment mode with timeline
The timeline doesn't trigger anything yet, but the visual element is in place and connected.
Diffstat (limited to 'src/components/timeline/TimelineControlsComponent.js')
| -rw-r--r-- | src/components/timeline/TimelineControlsComponent.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/timeline/TimelineControlsComponent.js b/src/components/timeline/TimelineControlsComponent.js new file mode 100644 index 00000000..3f37c3bc --- /dev/null +++ b/src/components/timeline/TimelineControlsComponent.js @@ -0,0 +1,33 @@ +import React from "react"; +import PlayButtonContainer from "../../containers/timeline/PlayButtonContainer"; + +function getXPercentage(tick, maxTick) { + if (maxTick === 0) { + return "0%"; + } else if (tick > maxTick) { + return "100%"; + } + + return (tick / maxTick) + "%"; +} + +const TimelineControlsComponent = ({currentTick, lastSimulatedTick, sectionTicks}) => ( + <div className="timeline-controls"> + <PlayButtonContainer/> + <div className="timeline"> + <div + className="time-marker" + style={{left: getXPercentage(currentTick, lastSimulatedTick)}} + /> + {sectionTicks.map(sectionTick => ( + <div + key={sectionTick} + className="section-marker" + style={{left: getXPercentage(sectionTick, lastSimulatedTick)}} + /> + ))} + </div> + </div> +); + +export default TimelineControlsComponent; |
