blob: 3f37c3bcc06be8469f46eceefa3b6bff41b584d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
|