aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/animationtimeline/Timeline.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/animationtimeline/Timeline.tsx')
-rw-r--r--src/client/views/animationtimeline/Timeline.tsx286
1 files changed, 172 insertions, 114 deletions
diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx
index e80ba6f36..7a393a4f7 100644
--- a/src/client/views/animationtimeline/Timeline.tsx
+++ b/src/client/views/animationtimeline/Timeline.tsx
@@ -1,19 +1,19 @@
-import { faBackward, faForward, faGripLines, faPauseCircle, faPlayCircle } from "@fortawesome/free-solid-svg-icons";
+import { faBackward, faForward, faGripLines, faPauseCircle, faPlayCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { action, computed, observable, runInAction, trace } from "mobx";
-import { observer } from "mobx-react";
-import * as React from "react";
-import { Doc, DocListCast } from "../../../fields/Doc";
-import { BoolCast, Cast, NumCast, StrCast } from "../../../fields/Types";
-import { Utils, setupMoveUpEvents, emptyFunction, returnFalse } from "../../../Utils";
-import { FieldViewProps } from "../nodes/FieldView";
-import { KeyframeFunc } from "./Keyframe";
-import "./Timeline.scss";
-import { TimelineOverview } from "./TimelineOverview";
-import { Track } from "./Track";
-import clamp from "../../util/clamp";
-import { DocumentType } from "../../documents/DocumentTypes";
-import { IconLookup } from "@fortawesome/fontawesome-svg-core";
+import { action, computed, observable, runInAction, trace } from 'mobx';
+import { observer } from 'mobx-react';
+import * as React from 'react';
+import { Doc, DocListCast } from '../../../fields/Doc';
+import { BoolCast, Cast, NumCast, StrCast } from '../../../fields/Types';
+import { Utils, setupMoveUpEvents, emptyFunction, returnFalse } from '../../../Utils';
+import { FieldViewProps } from '../nodes/FieldView';
+import { KeyframeFunc } from './Keyframe';
+import './Timeline.scss';
+import { TimelineOverview } from './TimelineOverview';
+import { Track } from './Track';
+import clamp from '../../util/clamp';
+import { DocumentType } from '../../documents/DocumentTypes';
+import { IconLookup } from '@fortawesome/fontawesome-svg-core';
/**
* Timeline class controls most of timeline functions besides individual keyframe and track mechanism. Main functions are
@@ -35,10 +35,8 @@ import { IconLookup } from "@fortawesome/fontawesome-svg-core";
@author Andrew Kim
*/
-
@observer
export class Timeline extends React.Component<FieldViewProps> {
-
//readonly constants
private readonly DEFAULT_TICK_SPACING: number = 50;
private readonly MAX_TITLE_HEIGHT = 75;
@@ -57,8 +55,7 @@ export class Timeline extends React.Component<FieldViewProps> {
@observable private _roundToggleRef = React.createRef<HTMLDivElement>();
@observable private _roundToggleContainerRef = React.createRef<HTMLDivElement>();
-
- //boolean vars and instance vars
+ //boolean vars and instance vars
@observable private _currentBarX: number = 0;
@observable private _windSpeed: number = 1;
@observable private _isPlaying: boolean = false; //scrubber playing
@@ -73,13 +70,13 @@ export class Timeline extends React.Component<FieldViewProps> {
@observable private _titleHeight = 0;
/**
- * collection get method. Basically defines what defines collection's children. These will be tracked in the timeline. Do not edit.
+ * collection get method. Basically defines what defines collection's children. These will be tracked in the timeline. Do not edit.
*/
@computed
private get children(): Doc[] {
const annotatedDoc = [DocumentType.IMG, DocumentType.VID, DocumentType.PDF, DocumentType.MAP].includes(StrCast(this.props.Document.type) as any);
if (annotatedDoc) {
- return DocListCast(this.props.Document[Doc.LayoutFieldKey(this.props.Document) + "-annotations"]);
+ return DocListCast(this.props.Document[Doc.LayoutFieldKey(this.props.Document) + '-annotations']);
}
return DocListCast(this.props.Document[this.props.fieldKey]);
}
@@ -91,7 +88,8 @@ export class Timeline extends React.Component<FieldViewProps> {
this._titleHeight = relativeHeight < this.MAX_TITLE_HEIGHT ? relativeHeight : this.MAX_TITLE_HEIGHT; //check if relHeight is less than Maxheight. Else, just set relheight to max
this.MIN_CONTAINER_HEIGHT = this._titleHeight + 130; //offset
this.DEFAULT_CONTAINER_HEIGHT = this._titleHeight * 2 + 130; //twice the titleheight + offset
- if (!this.props.Document.AnimationLength) { //if animation length did not exist
+ if (!this.props.Document.AnimationLength) {
+ //if animation length did not exist
this.props.Document.AnimationLength = this._time; //set it to default time
} else {
this._time = NumCast(this.props.Document.AnimationLength); //else, set time to animationlength stored from before
@@ -116,24 +114,29 @@ export class Timeline extends React.Component<FieldViewProps> {
drawTicks = () => {
const ticks = [];
for (let i = 0; i < this._time / this._tickIncrement; i++) {
- ticks.push(<div key={Utils.GenerateGuid()} className="tick" style={{ transform: `translate(${i * this._tickSpacing}px)`, position: "absolute", pointerEvents: "none" }}> <p className="number-label">{this.toReadTime(i * this._tickIncrement)}</p></div>);
+ ticks.push(
+ <div key={Utils.GenerateGuid()} className="tick" style={{ transform: `translate(${i * this._tickSpacing}px)`, position: 'absolute', pointerEvents: 'none' }}>
+ {' '}
+ <p className="number-label">{this.toReadTime(i * this._tickIncrement)}</p>
+ </div>
+ );
}
return ticks;
- }
+ };
/**
* changes the scrubber to actual pixel position
*/
@action
changeCurrentBarX = (pixel: number) => {
- pixel <= 0 ? this._currentBarX = 0 : pixel >= this._totalLength ? this._currentBarX = this._totalLength : this._currentBarX = pixel;
- }
+ pixel <= 0 ? (this._currentBarX = 0) : pixel >= this._totalLength ? (this._currentBarX = this._totalLength) : (this._currentBarX = pixel);
+ };
//for playing
onPlay = (e: React.MouseEvent) => {
e.stopPropagation();
this.play();
- }
+ };
/**
* when playbutton is clicked
@@ -149,8 +152,7 @@ export class Timeline extends React.Component<FieldViewProps> {
this._isPlaying = !this._isPlaying;
this._playButton = this._isPlaying ? faPauseCircle : faPlayCircle;
this._isPlaying && playTimeline();
- }
-
+ };
/**
* fast forward the timeline scrubbing
@@ -159,30 +161,32 @@ export class Timeline extends React.Component<FieldViewProps> {
windForward = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
- if (this._windSpeed < 64) { //max speed is 32
+ if (this._windSpeed < 64) {
+ //max speed is 32
this._windSpeed = this._windSpeed * 2;
}
- }
+ };
/**
- * rewind the timeline scrubbing
+ * rewind the timeline scrubbing
*/
@action
windBackward = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
- if (this._windSpeed > 1 / 16) { // min speed is 1/8
+ if (this._windSpeed > 1 / 16) {
+ // min speed is 1/8
this._windSpeed = this._windSpeed / 2;
}
- }
+ };
/**
- * scrubber down
+ * scrubber down
*/
@action
onScrubberDown = (e: React.PointerEvent) => {
setupMoveUpEvents(this, e, this.onScrubberMove, emptyFunction, emptyFunction);
- }
+ };
/**
* when there is any scrubber movement
@@ -194,16 +198,15 @@ export class Timeline extends React.Component<FieldViewProps> {
const offsetX = Math.round(e.clientX - left) * this.props.ScreenToLocalTransform().Scale;
this.changeCurrentBarX(offsetX + this._visibleStart); //changes scrubber to clicked scrubber position
return false;
- }
+ };
/**
* when panning the timeline (in editing mode)
*/
@action
onPanDown = (e: React.PointerEvent) => {
- setupMoveUpEvents(this, e, this.onPanMove, emptyFunction, (e) =>
- this.changeCurrentBarX(this._trackbox.current!.scrollLeft + e.clientX - this._trackbox.current!.getBoundingClientRect().left));
- }
+ setupMoveUpEvents(this, e, this.onPanMove, emptyFunction, e => this.changeCurrentBarX(this._trackbox.current!.scrollLeft + e.clientX - this._trackbox.current!.getBoundingClientRect().left));
+ };
/**
* when moving the timeline (in editing mode)
@@ -218,29 +221,34 @@ export class Timeline extends React.Component<FieldViewProps> {
if (this._visibleStart + this._visibleLength + 20 >= this._totalLength) {
this._visibleStart -= e.movementX;
this._totalLength -= e.movementX;
- this._time -= KeyframeFunc.convertPixelTime(e.movementX, "mili", "time", this._tickSpacing, this._tickIncrement);
+ this._time -= KeyframeFunc.convertPixelTime(e.movementX, 'mili', 'time', this._tickSpacing, this._tickIncrement);
this.props.Document.AnimationLength = this._time;
}
return false;
- }
-
+ };
@action
movePanX = (pixel: number) => {
this._infoContainer.current!.scrollLeft = pixel;
this._visibleStart = this._infoContainer.current!.scrollLeft;
- }
+ };
/**
* resizing timeline (in editing mode) (the hamburger drag icon)
*/
onResizeDown = (e: React.PointerEvent) => {
- setupMoveUpEvents(this, e, action((e) => {
- const offset = e.clientY - this._timelineContainer.current!.getBoundingClientRect().bottom;
- this._containerHeight = clamp(this.MIN_CONTAINER_HEIGHT, this._containerHeight + offset, this.MAX_CONTAINER_HEIGHT);
- return false;
- }), emptyFunction, emptyFunction);
- }
+ setupMoveUpEvents(
+ this,
+ e,
+ action(e => {
+ const offset = e.clientY - this._timelineContainer.current!.getBoundingClientRect().bottom;
+ this._containerHeight = clamp(this.MIN_CONTAINER_HEIGHT, this._containerHeight + offset, this.MAX_CONTAINER_HEIGHT);
+ return false;
+ }),
+ emptyFunction,
+ emptyFunction
+ );
+ };
/**
* for displaying time to standard min:sec
@@ -251,19 +259,18 @@ export class Timeline extends React.Component<FieldViewProps> {
const inSeconds = Math.round(time * 100) / 100;
const min = Math.floor(inSeconds / 60);
- const sec = (Math.round((inSeconds % 60) * 100) / 100);
+ const sec = Math.round((inSeconds % 60) * 100) / 100;
let secString = sec.toFixed(2);
if (Math.floor(sec / 10) === 0) {
- secString = "0" + secString;
+ secString = '0' + secString;
}
return `${min}:${secString}`;
- }
-
+ };
/**
- * timeline zoom function
+ * timeline zoom function
* use mouse middle button to zoom in/out the timeline
*/
@action
@@ -271,17 +278,16 @@ export class Timeline extends React.Component<FieldViewProps> {
e.preventDefault();
e.stopPropagation();
const offset = e.clientX - this._infoContainer.current!.getBoundingClientRect().left;
- const prevTime = KeyframeFunc.convertPixelTime(this._visibleStart + offset, "mili", "time", this._tickSpacing, this._tickIncrement);
- const prevCurrent = KeyframeFunc.convertPixelTime(this._currentBarX, "mili", "time", this._tickSpacing, this._tickIncrement);
+ const prevTime = KeyframeFunc.convertPixelTime(this._visibleStart + offset, 'mili', 'time', this._tickSpacing, this._tickIncrement);
+ const prevCurrent = KeyframeFunc.convertPixelTime(this._currentBarX, 'mili', 'time', this._tickSpacing, this._tickIncrement);
this.zoom(e.deltaY < 0);
- const currPixel = KeyframeFunc.convertPixelTime(prevTime, "mili", "pixel", this._tickSpacing, this._tickIncrement);
- const currCurrent = KeyframeFunc.convertPixelTime(prevCurrent, "mili", "pixel", this._tickSpacing, this._tickIncrement);
+ const currPixel = KeyframeFunc.convertPixelTime(prevTime, 'mili', 'pixel', this._tickSpacing, this._tickIncrement);
+ const currCurrent = KeyframeFunc.convertPixelTime(prevCurrent, 'mili', 'pixel', this._tickSpacing, this._tickIncrement);
this._infoContainer.current!.scrollLeft = currPixel - offset;
this._visibleStart = currPixel - offset > 0 ? currPixel - offset : 0;
this._visibleStart += this._visibleLength + this._visibleStart > this._totalLength ? this._totalLength - (this._visibleStart + this._visibleLength) : 0;
this.changeCurrentBarX(currCurrent);
- }
-
+ };
resetView(doc: Doc) {
doc._panX = doc._customOriginX ?? 0;
@@ -324,7 +330,7 @@ export class Timeline extends React.Component<FieldViewProps> {
this._tickSpacing = spacingChange;
this._tickIncrement = incrementChange;
}
- }
+ };
/**
* tool box includes the toggle buttons at the top of the timeline (both editing mode and play mode)
@@ -333,60 +339,90 @@ export class Timeline extends React.Component<FieldViewProps> {
const size = 40 * scale; //50 is default
const iconSize = 25;
const width: number = this.props.PanelWidth();
- const modeType = this.props.Document.isATOn ? "Author" : "Play";
+ const modeType = this.props.Document.isATOn ? 'Author' : 'Play';
//decides if information should be omitted because the timeline is very small
// if its less than 950 pixels then it's going to be overlapping
- let modeString = modeType, overviewString = "", lengthString = "";
+ let modeString = modeType,
+ overviewString = '',
+ lengthString = '';
if (width < 850) {
- modeString = "Mode: " + modeType;
- overviewString = "Overview:";
- lengthString = "Length: ";
+ modeString = 'Mode: ' + modeType;
+ overviewString = 'Overview:';
+ lengthString = 'Length: ';
}
return (
<div key="timeline_toolbox" className="timeline-toolbox" style={{ height: `${size}px` }}>
<div className="playbackControls">
- <div className="timeline-icon" key="timeline_windBack" onClick={this.windBackward} title="Slow Down Animation"> <FontAwesomeIcon icon={faBackward as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} /> </div>
- <div className="timeline-icon" key=" timeline_play" onClick={this.onPlay} title="Play/Pause"> <FontAwesomeIcon icon={this._playButton as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} /> </div>
- <div className="timeline-icon" key="timeline_windForward" onClick={this.windForward} title="Speed Up Animation"> <FontAwesomeIcon icon={faForward as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} /> </div>
+ <div className="timeline-icon" key="timeline_windBack" onClick={this.windBackward} title="Slow Down Animation">
+ {' '}
+ <FontAwesomeIcon icon={faBackward as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} />{' '}
+ </div>
+ <div className="timeline-icon" key=" timeline_play" onClick={this.onPlay} title="Play/Pause">
+ {' '}
+ <FontAwesomeIcon icon={this._playButton as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} />{' '}
+ </div>
+ <div className="timeline-icon" key="timeline_windForward" onClick={this.windForward} title="Speed Up Animation">
+ {' '}
+ <FontAwesomeIcon icon={faForward as IconLookup} style={{ height: `${iconSize}px`, width: `${iconSize}px` }} />{' '}
+ </div>
</div>
<div className="grid-box overview-tool">
<div className="overview-box">
- <div key="overview-text" className="animation-text">{overviewString}</div>
- <TimelineOverview tickSpacing={this._tickSpacing} tickIncrement={this._tickIncrement} time={this._time} parent={this} isAuthoring={BoolCast(this.props.Document.isATOn)} currentBarX={this._currentBarX} totalLength={this._totalLength} visibleLength={this._visibleLength} visibleStart={this._visibleStart} changeCurrentBarX={this.changeCurrentBarX} movePanX={this.movePanX} />
+ <div key="overview-text" className="animation-text">
+ {overviewString}
+ </div>
+ <TimelineOverview
+ tickSpacing={this._tickSpacing}
+ tickIncrement={this._tickIncrement}
+ time={this._time}
+ parent={this}
+ isAuthoring={BoolCast(this.props.Document.isATOn)}
+ currentBarX={this._currentBarX}
+ totalLength={this._totalLength}
+ visibleLength={this._visibleLength}
+ visibleStart={this._visibleStart}
+ changeCurrentBarX={this.changeCurrentBarX}
+ movePanX={this.movePanX}
+ />
</div>
<div className="mode-box overview-tool">
- <div key="animation-text" className="animation-text">{modeString}</div>
+ <div key="animation-text" className="animation-text">
+ {modeString}
+ </div>
<div key="round-toggle" ref={this._roundToggleContainerRef} className="round-toggle">
- <div key="round-toggle-slider" ref={this._roundToggleRef} className="round-toggle-slider" onPointerDown={this.toggleChecked}> </div>
+ <div key="round-toggle-slider" ref={this._roundToggleRef} className="round-toggle-slider" onPointerDown={this.toggleChecked}>
+ {' '}
+ </div>
</div>
</div>
- <div className="time-box overview-tool" style={{ display: "flex" }}>
+ <div className="time-box overview-tool" style={{ display: 'flex' }}>
{this.timeIndicator(lengthString, totalTime)}
- <div className="resetView-tool" title="Return to Default View" onClick={() => this.resetView(this.props.Document)}><FontAwesomeIcon icon="compress-arrows-alt" size="lg" /></div>
- <div className="resetView-tool" style={{ display: this.props.Document.isATOn ? "flex" : "none" }} title="Set Default View" onClick={() => this.setView(this.props.Document)}><FontAwesomeIcon icon="expand-arrows-alt" size="lg" /></div>
+ <div className="resetView-tool" title="Return to Default View" onClick={() => this.resetView(this.props.Document)}>
+ <FontAwesomeIcon icon="compress-arrows-alt" size="lg" />
+ </div>
+ <div className="resetView-tool" style={{ display: this.props.Document.isATOn ? 'flex' : 'none' }} title="Set Default View" onClick={() => this.setView(this.props.Document)}>
+ <FontAwesomeIcon icon="expand-arrows-alt" size="lg" />
+ </div>
</div>
</div>
</div>
);
- }
+ };
timeIndicator(lengthString: string, totalTime: number) {
if (this.props.Document.isATOn) {
- return (
- <div key="time-text" className="animation-text" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden", display: this.props.Document.isATOn ? "flex" : "none" }}>{`Total: ${this.toReadTime(totalTime)}`}</div>
- );
- }
- else {
+ return <div key="time-text" className="animation-text" style={{ visibility: this.props.Document.isATOn ? 'visible' : 'hidden', display: this.props.Document.isATOn ? 'flex' : 'none' }}>{`Total: ${this.toReadTime(totalTime)}`}</div>;
+ } else {
const ctime = `Current: ${this.getCurrentTime()}`;
const ttime = `Total: ${this.toReadTime(this._time)}`;
return (
- <div style={{ flexDirection: "column" }}>
- <div className="animation-text" style={{ fontSize: "10px", width: "100%", display: !this.props.Document.isATOn ? "block" : "none" }}>
+ <div style={{ flexDirection: 'column' }}>
+ <div className="animation-text" style={{ fontSize: '10px', width: '100%', display: !this.props.Document.isATOn ? 'block' : 'none' }}>
{ctime}
</div>
- <div className="animation-text" style={{ fontSize: "10px", width: "100%", display: !this.props.Document.isATOn ? "block" : "none" }}>
+ <div className="animation-text" style={{ fontSize: '10px', width: '100%', display: !this.props.Document.isATOn ? 'block' : 'none' }}>
{ttime}
</div>
</div>
@@ -402,7 +438,7 @@ export class Timeline extends React.Component<FieldViewProps> {
e.preventDefault();
e.stopPropagation();
this.toggleHandle();
- }
+ };
/**
* turns on the toggle button (the purple slide button that changes from editing mode and play mode
@@ -415,23 +451,22 @@ export class Timeline extends React.Component<FieldViewProps> {
this.props.Document.isATOn = !this.props.Document.isATOn;
if (!BoolCast(this.props.Document.isATOn)) {
//turning on playmode...
- roundToggle.style.transform = "translate(0px, 0px)";
- roundToggle.style.animationName = "turnoff";
- roundToggleContainer.style.animationName = "turnoff";
- roundToggleContainer.style.backgroundColor = "white";
+ roundToggle.style.transform = 'translate(0px, 0px)';
+ roundToggle.style.animationName = 'turnoff';
+ roundToggleContainer.style.animationName = 'turnoff';
+ roundToggleContainer.style.backgroundColor = 'white';
timelineContainer.style.top = `${-this._containerHeight}px`;
this.toPlay();
} else {
//turning on authoring mode...
- roundToggle.style.transform = "translate(20px, 0px)";
- roundToggle.style.animationName = "turnon";
- roundToggleContainer.style.animationName = "turnon";
- roundToggleContainer.style.backgroundColor = "#9acedf";
- timelineContainer.style.top = "0px";
+ roundToggle.style.transform = 'translate(20px, 0px)';
+ roundToggle.style.animationName = 'turnon';
+ roundToggleContainer.style.animationName = 'turnon';
+ roundToggleContainer.style.backgroundColor = '#9acedf';
+ timelineContainer.style.top = '0px';
this.toAuthoring();
}
- }
-
+ };
@action.bound
changeLengths() {
@@ -443,9 +478,9 @@ export class Timeline extends React.Component<FieldViewProps> {
// @computed
getCurrentTime = () => {
- const current = KeyframeFunc.convertPixelTime(this._currentBarX, "mili", "time", this._tickSpacing, this._tickIncrement);
+ const current = KeyframeFunc.convertPixelTime(this._currentBarX, 'mili', 'time', this._tickSpacing, this._tickIncrement);
return this.toReadTime(current > this._time ? this._time : current);
- }
+ };
@observable private mapOfTracks: (Track | null)[] = [];
@@ -465,22 +500,22 @@ export class Timeline extends React.Component<FieldViewProps> {
}
});
return longestTime;
- }
+ };
@action
toAuthoring = () => {
this._time = Math.ceil((this.findLongestTime() ?? 1) / 100000) * 100000;
- this._totalLength = KeyframeFunc.convertPixelTime(this._time, "mili", "pixel", this._tickSpacing, this._tickIncrement);
- }
+ this._totalLength = KeyframeFunc.convertPixelTime(this._time, 'mili', 'pixel', this._tickSpacing, this._tickIncrement);
+ };
@action
toPlay = () => {
this._time = this.findLongestTime();
- this._totalLength = KeyframeFunc.convertPixelTime(this._time, "mili", "pixel", this._tickSpacing, this._tickIncrement);
- }
+ this._totalLength = KeyframeFunc.convertPixelTime(this._time, 'mili', 'pixel', this._tickSpacing, this._tickIncrement);
+ };
/**
- * if you have any question here, just shoot me an email or text.
+ * if you have any question here, just shoot me an email or text.
* basically the only thing you need to edit besides render methods in track (individual track lines) and keyframe (green region)
*/
render() {
@@ -488,23 +523,46 @@ export class Timeline extends React.Component<FieldViewProps> {
// change visible and total width
return (
- <div style={{ visibility: "visible" }}>
- <div key="timeline_wrapper" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden", left: "0px", top: "0px", position: "absolute", width: "100%", transform: "translate(0px, 0px)" }}>
+ <div style={{ visibility: 'visible' }}>
+ <div key="timeline_wrapper" style={{ visibility: this.props.Document.isATOn ? 'visible' : 'hidden', left: '0px', top: '0px', position: 'absolute', width: '100%', transform: 'translate(0px, 0px)' }}>
<div key="timeline_container" className="timeline-container" ref={this._timelineContainer} style={{ height: `${this._containerHeight}px`, top: `0px` }}>
<div key="timeline_info" className="info-container" onPointerDown={this.onPanDown} ref={this._infoContainer} onWheel={this.onWheelZoom}>
{this.drawTicks()}
<div key="timeline_scrubber" className="scrubber" style={{ transform: `translate(${this._currentBarX}px)` }}>
- <div key="timeline_scrubberhead" className="scrubberhead" onPointerDown={this.onScrubberDown} ></div>
+ <div key="timeline_scrubberhead" className="scrubberhead" onPointerDown={this.onScrubberDown}></div>
</div>
<div key="timeline_trackbox" className="trackbox" ref={this._trackbox} style={{ width: `${this._totalLength}px` }}>
- {this.children.map(doc =>
- <Track ref={ref => this.mapOfTracks.push(ref)} node={doc} currentBarX={this._currentBarX} changeCurrentBarX={this.changeCurrentBarX} transform={this.props.ScreenToLocalTransform()} time={this._time} tickSpacing={this._tickSpacing} tickIncrement={this._tickIncrement} collection={this.props.Document} timelineVisible={true} />
- )}
+ {this.children.map(doc => (
+ <Track
+ ref={ref => this.mapOfTracks.push(ref)}
+ node={doc}
+ currentBarX={this._currentBarX}
+ changeCurrentBarX={this.changeCurrentBarX}
+ transform={this.props.ScreenToLocalTransform()}
+ time={this._time}
+ tickSpacing={this._tickSpacing}
+ tickIncrement={this._tickIncrement}
+ collection={this.props.Document}
+ timelineVisible={true}
+ />
+ ))}
</div>
</div>
<div className="currentTime">Current: {this.getCurrentTime()}</div>
<div key="timeline_title" className="title-container" ref={this._titleContainer}>
- {this.children.map(doc => <div style={{ height: `${(this._titleHeight)}px` }} className="datapane" onPointerOver={() => { Doc.BrushDoc(doc); }} onPointerOut={() => { Doc.UnBrushDoc(doc); }}><p>{doc.title}</p></div>)}
+ {this.children.map(doc => (
+ <div
+ style={{ height: `${this._titleHeight}px` }}
+ className="datapane"
+ onPointerOver={() => {
+ Doc.BrushDoc(doc);
+ }}
+ onPointerOut={() => {
+ Doc.UnBrushDoc(doc);
+ }}>
+ <p>{StrCast(doc.title)}</p>
+ </div>
+ ))}
</div>
<div key="timeline_resize" onPointerDown={this.onResizeDown}>
<FontAwesomeIcon className="resize" icon={faGripLines as IconLookup} />
@@ -515,4 +573,4 @@ export class Timeline extends React.Component<FieldViewProps> {
</div>
);
}
-} \ No newline at end of file
+}