aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/animationtimeline/Keyframe.scss151
-rw-r--r--src/client/views/animationtimeline/Keyframe.tsx81
-rw-r--r--src/client/views/animationtimeline/Timeline.scss38
-rw-r--r--src/client/views/animationtimeline/Timeline.tsx35
-rw-r--r--src/client/views/animationtimeline/TimelineOverview.scss9
-rw-r--r--src/client/views/animationtimeline/TimelineOverview.tsx54
-rw-r--r--src/client/views/animationtimeline/Track.scss17
-rw-r--r--src/client/views/animationtimeline/Track.tsx2
8 files changed, 234 insertions, 153 deletions
diff --git a/src/client/views/animationtimeline/Keyframe.scss b/src/client/views/animationtimeline/Keyframe.scss
index b1e8b0b65..8dcf71994 100644
--- a/src/client/views/animationtimeline/Keyframe.scss
+++ b/src/client/views/animationtimeline/Keyframe.scss
@@ -1,94 +1,109 @@
-@import "./../globalCssVariables.scss";
+@import "./../globalCssVariables.scss";
+
+
+$timelineColor: #9acedf;
+$timelineDark: #77a1aa;
.bar {
height: 100%;
width: 5px;
position: absolute;
-
+
// pointer-events: none;
.menubox {
- width: 200px;
- height:200px;
+ width: 200px;
+ height: 200px;
top: 50%;
- position: relative;
- background-color: $light-color;
- .menutable{
- tr:nth-child(odd){
- background-color:$light-color-secondary;
+ position: relative;
+ background-color: $light-color;
+
+ .menutable {
+ tr:nth-child(odd) {
+ background-color: $light-color-secondary;
}
}
}
- .leftResize{
- left:-12.5px;
- height:25px;
- width:25px;
- border-radius: 50%;
+ .leftResize {
+ left: -10px;
+ border: 3px solid black;
+ }
+
+ .rightResize {
+ right: -10px;
+ border: 3px solid black;
+ }
+
+ .keyframe-indicator {
+ height: 20px;
+ width: 20px;
+ top: calc(50% - 10px);
background-color: white;
- border:3px solid black;
- top: calc(50% - 12.5px);
- z-index: 1000;
- position:absolute;
+ -ms-transform: rotate(45deg);
+ -webkit-transform: rotate(45deg);
+ transform: rotate(45deg);
+ z-index: 1000;
+ position: absolute;
}
- .rightResize{
- right:-12.5px;
- height:25px;
- width:25px;
- border-radius: 50%;
- top:calc(50% - 12.5px);
- background-color:white;
- border:3px solid black;
- z-index: 1000;
- position:absolute;
+
+ // .keyframe:hover~.keyframe-information {
+ // display: flex;
+ // }
+
+ .keyframe-information {
+ display: none;
+ position: relative;
+ // z-index: 100000;
+ // background: $timelineDark;
+ width: 100px;
+ // left: -50px;
+ height: 100px;
+ // top: 40px;
}
- .fadeLeft{
- left:0px;
- height:100%;
- position:absolute;
- pointer-events: none;
- background: linear-gradient(to left, #4d9900 10%, $light-color);
+
+ .keyframeCircle {
+ left: -10px;
+ border: 3px solid $timelineDark;
}
- .fadeRight{
- right:0px;
- height:100%;
- position:absolute;
- pointer-events: none;
- background: linear-gradient(to right, #4d9900 10%, $light-color);
+ .fadeLeft {
+ left: 0px;
+ height: 100%;
+ position: absolute;
+ pointer-events: none;
+ background: linear-gradient(to left, $timelineColor 10%, $light-color);
}
- .divider{
- height:100%;
- width: 1px;
- position: absolute;
- background-color:black;
- cursor: col-resize;
- pointer-events:none;
+
+ .fadeRight {
+ right: 0px;
+ height: 100%;
+ position: absolute;
+ pointer-events: none;
+ background: linear-gradient(to right, $timelineColor 10%, $light-color);
}
- .keyframe{
- height:100%;
- position:absolute;
+
+ .divider {
+ height: 100%;
+ width: 1px;
+ position: absolute;
+ background-color: black;
+ cursor: col-resize;
+ pointer-events: none;
}
- .keyframeCircle{
- left:-15px;
- height:30px;
- width:30px;
- border-radius: 50%;
- top:calc(50% - 15px);
- background-color:white;
- border:3px solid green;
- z-index: 1000;
- position:absolute;
+
+ .keyframe {
+ height: 100%;
+ position: absolute;
}
- .fadeIn-container, .fadeOut-container, .body-container{
- position:absolute;
- height:100%;
+ .fadeIn-container,
+ .fadeOut-container,
+ .body-container {
+ position: absolute;
+ height: 100%;
background-color: rgba(0, 0, 0, 0.5);
- opacity: 0;
+ opacity: 0;
}
-
-
-}
-
+} \ No newline at end of file
diff --git a/src/client/views/animationtimeline/Keyframe.tsx b/src/client/views/animationtimeline/Keyframe.tsx
index 393168ac3..a2add3ae8 100644
--- a/src/client/views/animationtimeline/Keyframe.tsx
+++ b/src/client/views/animationtimeline/Keyframe.tsx
@@ -92,7 +92,7 @@ export namespace KeyframeFunc {
regiondata.fadeIn = 1000;
regiondata.fadeOut = 1000;
regiondata.functions = new List<Doc>();
- regiondata.hasData = false;
+ regiondata.hasData = false;
return regiondata;
};
@@ -120,7 +120,7 @@ export const RegionDataSchema = createSchema({
keyframes: listSpec(Doc),
fadeIn: defaultSpec("number", 0),
fadeOut: defaultSpec("number", 0),
- functions: listSpec(Doc),
+ functions: listSpec(Doc),
hasData: defaultSpec("boolean", false)
});
export type RegionData = makeInterface<[typeof RegionDataSchema]>;
@@ -192,7 +192,7 @@ export class Keyframe extends React.Component<IProps> {
}, 1000);
}
-
+
@action
@@ -276,10 +276,10 @@ export class Keyframe extends React.Component<IProps> {
} else if (NumCast(this.keyframes[1].time) + offset >= NumCast(this.keyframes[2].time)) {
this.regiondata.position = NumCast(this.keyframes[2].time) - this.regiondata.fadeIn;
this.regiondata.duration = NumCast(this.keyframes[this.keyframes.length - 1].time) - NumCast(this.keyframes[2].time) + this.regiondata.fadeIn;
- } else if (NumCast(this.keyframes[0].time) + offset <= 0){
- this.regiondata.position = 0;
- this.regiondata.duration = NumCast(this.keyframes[this.keyframes.length - 1].time);
- }else {
+ } else if (NumCast(this.keyframes[0].time) + offset <= 0) {
+ this.regiondata.position = 0;
+ this.regiondata.duration = NumCast(this.keyframes[this.keyframes.length - 1].time);
+ } else {
this.regiondata.duration -= offset;
this.regiondata.position += offset;
}
@@ -318,7 +318,7 @@ export class Keyframe extends React.Component<IProps> {
this.props.makeKeyData(this.regiondata, Math.round(position + offset), KeyframeFunc.KeyframeType.default);
this.regiondata.hasData = true;
this.props.changeCurrentBarX(KeyframeFunc.convertPixelTime(Math.round(position + offset), "mili", "pixel", this.props.tickSpacing, this.props.tickIncrement)); //first move the keyframe to the correct location and make a copy so the correct file gets coppied
-
+
}
}
@@ -349,15 +349,15 @@ export class Keyframe extends React.Component<IProps> {
}),
TimelineMenu.Instance.addItem("input", "Move", (val) => {
runInAction(() => {
- let cannotMove: boolean = false;
- let kfIndex: number = this.keyframes.indexOf(kf);
- if (val < 0 || (val < NumCast(this.keyframes[kfIndex - 1].time) || val > NumCast(this.keyframes[kfIndex + 1].time))) {
- cannotMove = true;
- }
- if (!cannotMove) {
- this.keyframes[kfIndex].time = parseInt(val, 10);
- this.keyframes[1].time = this.regiondata.position + this.regiondata.fadeIn;
- }
+ let cannotMove: boolean = false;
+ let kfIndex: number = this.keyframes.indexOf(kf);
+ if (val < 0 || (val < NumCast(this.keyframes[kfIndex - 1].time) || val > NumCast(this.keyframes[kfIndex + 1].time))) {
+ cannotMove = true;
+ }
+ if (!cannotMove) {
+ this.keyframes[kfIndex].time = parseInt(val, 10);
+ this.keyframes[1].time = this.regiondata.position + this.regiondata.fadeIn;
+ }
});
});
TimelineMenu.Instance.addMenu("Keyframe");
@@ -369,22 +369,22 @@ export class Keyframe extends React.Component<IProps> {
*/
@action
makeRegionMenu = (kf: Doc, e: MouseEvent) => {
- TimelineMenu.Instance.addItem("button", "Remove Region", () => {
- runInAction(() => {
- this.regions.splice(this.regions.indexOf(this.props.RegionData), 1);
- }
- );
- }),
+ TimelineMenu.Instance.addItem("button", "Remove Region", () => {
+ runInAction(() => {
+ this.regions.splice(this.regions.indexOf(this.props.RegionData), 1);
+ }
+ );
+ }),
TimelineMenu.Instance.addItem("input", `fadeIn: ${this.regiondata.fadeIn}ms`, (val) => {
runInAction(() => {
- let cannotMove: boolean = false;
- if (val < 0 || val > NumCast(this.keyframes[2].time) - this.regiondata.position) {
- cannotMove = true;
- }
- if (!cannotMove) {
- this.regiondata.fadeIn = parseInt(val, 10);
- this.keyframes[1].time = this.regiondata.position + this.regiondata.fadeIn;
- }
+ let cannotMove: boolean = false;
+ if (val < 0 || val > NumCast(this.keyframes[2].time) - this.regiondata.position) {
+ cannotMove = true;
+ }
+ if (!cannotMove) {
+ this.regiondata.fadeIn = parseInt(val, 10);
+ this.keyframes[1].time = this.regiondata.position + this.regiondata.fadeIn;
+ }
});
}),
TimelineMenu.Instance.addItem("input", `fadeOut: ${this.regiondata.fadeOut}ms`, (val) => {
@@ -470,7 +470,7 @@ export class Keyframe extends React.Component<IProps> {
div.style.opacity = "0";
Doc.UnBrushDoc(this.props.node);
}
-
+
///////////////////////UI STUFF /////////////////////////
@@ -485,14 +485,18 @@ export class Keyframe extends React.Component<IProps> {
DocListCast(this.regiondata.keyframes).forEach(kf => {
if (kf.type as KeyframeFunc.KeyframeType !== KeyframeFunc.KeyframeType.end) {
keyframeDivs.push(
- <div className="keyframe" style={{ left: `${KeyframeFunc.convertPixelTime(NumCast(kf.time), "mili", "pixel", this.props.tickSpacing, this.props.tickIncrement) - this.pixelPosition}px` }}>
+ <><div className="keyframe" style={{ left: `${KeyframeFunc.convertPixelTime(NumCast(kf.time), "mili", "pixel", this.props.tickSpacing, this.props.tickIncrement) - this.pixelPosition}px` }}>
<div className="divider"></div>
- <div className="keyframeCircle" onPointerDown={(e) => { e.preventDefault(); e.stopPropagation(); this.moveKeyframe(e, kf); }} onContextMenu={(e: React.MouseEvent) => {
+ <div className="keyframeCircle keyframe-indicator" onPointerDown={(e) => { e.preventDefault(); e.stopPropagation(); this.moveKeyframe(e, kf); }} onContextMenu={(e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
this.makeKeyframeMenu(kf, e.nativeEvent);
}} onDoubleClick={(e) => { e.preventDefault(); e.stopPropagation(); }}></div>
+
</div>
+ <div className="keyframe-information"></div>
+ </>
+
);
} else {
keyframeDivs.push(
@@ -540,18 +544,21 @@ export class Keyframe extends React.Component<IProps> {
/**
* rendering that green region
*/
+ //154, 206, 223
render() {
return (
<div>
<div className="bar" ref={this._bar} style={{
transform: `translate(${this.pixelPosition}px)`,
width: `${this.pixelDuration}px`,
- background: `linear-gradient(90deg, rgba(77, 153, 0, 0) 0%, rgba(77, 153, 0, 1) ${this.pixelFadeIn / this.pixelDuration * 100}%, rgba(77, 153, 0, 1) ${(this.pixelDuration - this.pixelFadeOut) / this.pixelDuration * 100}%, rgba(77, 153, 0, 0) 100% )`
+ background: `linear-gradient(90deg, rgba(154, 206, 223, 0) 0%, rgba(154, 206, 223, 1) ${this.pixelFadeIn / this.pixelDuration * 100}%, rgba(154, 206, 223, 1) ${(this.pixelDuration - this.pixelFadeOut) / this.pixelDuration * 100}%, rgba(154, 206, 223, 0) 100% )`
}}
onPointerDown={this.onBarPointerDown
}>
- <div className="leftResize" onPointerDown={this.onResizeLeft} ></div>
- <div className="rightResize" onPointerDown={this.onResizeRight}></div>
+ <div className="leftResize keyframe-indicator" onPointerDown={this.onResizeLeft} ></div>
+ {/* <div className="keyframe-information"></div> */}
+ <div className="rightResize keyframe-indicator" onPointerDown={this.onResizeRight}></div>
+ {/* <div className="keyframe-information"></div> */}
{this.drawKeyframes()}
{this.drawKeyframeDividers()}
</div>
diff --git a/src/client/views/animationtimeline/Timeline.scss b/src/client/views/animationtimeline/Timeline.scss
index a8dd9b9e7..ce8c845df 100644
--- a/src/client/views/animationtimeline/Timeline.scss
+++ b/src/client/views/animationtimeline/Timeline.scss
@@ -43,6 +43,8 @@ $timelineDark: #77a1aa;
.time-box {
margin-left: 5px;
display: flex;
+ justify-content: center;
+ align-items: center;
}
.mode-box {
@@ -61,6 +63,12 @@ $timelineDark: #77a1aa;
}
}
+ .overview-tool {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
.animation-text {
// font-size: 16px;
height: auto;
@@ -179,13 +187,14 @@ $timelineDark: #77a1aa;
.trackbox {
top: 30px;
- // TODO: where is this 30px coming from?
height: calc(100% - 30px);
// height: 100%;
+ // height: 100%;
width: 100%;
border-top: 2px solid black;
border-bottom: 2px solid black;
overflow: hidden;
+ // overflow-y: scroll;
background-color: white;
position: absolute;
// box-shadow: -10px 0px 10px 10px red;
@@ -193,10 +202,25 @@ $timelineDark: #77a1aa;
}
+ .currentTime {
+ // background: red;
+ font-size: 12px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 40px;
+ top: 40px;
+ position: relative;
+ width: 100px;
+ margin-left: 20px;
+ }
+
.title-container {
- margin-top: 80px;
+ // margin-top: 80px;
+ margin-top: 40px;
margin-left: 20px;
height: calc(100% - 100px - 30px);
+ // height: 100%;
width: 100px;
background-color: white;
overflow: hidden;
@@ -210,13 +234,21 @@ $timelineDark: #77a1aa;
width: 100px;
height: 30%;
border: 1px solid $dark-color;
- background-color: $intermediate-color;
+ font-size: 12px;
+ line-height: 11px;
+ background-color: $timelineDark;
color: white;
position: relative;
float: left;
+ padding: 3px;
border-style: solid;
overflow-y: scroll;
overflow-x: hidden;
+
+ p {
+ hyphens: auto;
+ }
+
}
}
diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx
index da9c361da..f74d4c71e 100644
--- a/src/client/views/animationtimeline/Timeline.tsx
+++ b/src/client/views/animationtimeline/Timeline.tsx
@@ -99,7 +99,7 @@ export class Timeline extends React.Component<FieldViewProps> {
/////////lifecycle functions////////////
componentWillMount() {
- let relativeHeight = window.innerHeight / 14; //sets height to arbitrary size, relative to innerHeight
+ let relativeHeight = window.innerHeight / 20; //sets height to arbitrary size, relative to innerHeight
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
@@ -310,6 +310,7 @@ export class Timeline extends React.Component<FieldViewProps> {
e.preventDefault();
e.stopPropagation();
let offset = e.clientY - this._timelineContainer.current!.getBoundingClientRect().bottom;
+ // let offset = 0;
if (this._containerHeight + offset <= this.MIN_CONTAINER_HEIGHT) {
this._containerHeight = this.MIN_CONTAINER_HEIGHT;
} else if (this._containerHeight + offset >= this.MAX_CONTAINER_HEIGHT) {
@@ -324,7 +325,10 @@ export class Timeline extends React.Component<FieldViewProps> {
*/
@action
toReadTime = (time: number): string => {
- const inSeconds = time / 1000;
+ time = time / 1000;
+ var inSeconds = Math.round((time * 100)) / 100;
+ // var inSeconds = parseFloat(time.toFixed(2));
+ // const inSeconds = (Math.floor(time) / 1000);
let min: (string | number) = Math.floor(inSeconds / 60);
let sec: (string | number) = inSeconds % 60;
@@ -429,12 +433,6 @@ export class Timeline extends React.Component<FieldViewProps> {
lengthString = "";
}
-
- // let modeType: string = this.props.Document.isATOn ? "Author" : "Play";
- // let modeString: string = "Mode: " + modeType;
- // let overviewString: string = "Overview:";
- // let lengthString: string = "Length: ";
-
return (
<div key="timeline_toolbox" className="timeline-toolbox" style={{ height: `${size}px` }}>
<div className="playbackControls">
@@ -445,7 +443,7 @@ export class Timeline extends React.Component<FieldViewProps> {
<div className="grid-box overview-tool">
<div className="overview-box">
<div key="overview-text" className="animation-text">{overviewString}</div>
- <TimelineOverview panelWidth={this._panelWidth} 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} />
+ <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>
@@ -454,8 +452,9 @@ export class Timeline extends React.Component<FieldViewProps> {
</div>
</div>
<div className="time-box overview-tool" style={{ display: this._timelineVisible ? "flex" : "none" }}>
- <div key="time-text" className="animation-text" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden" }}>{lengthString}</div>
- <input className="time-input" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden" }} placeholder={String(Math.floor(this._time) / 1000) + " s"} ref={this._timeInputRef} onKeyDown={this.onTimeInput} />
+ <div key="time-text" className="animation-text" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden", display: this.props.Document.isATOn ? "flex" : "none" }}>{lengthString}</div>
+ <input className="time-input" style={{ visibility: this.props.Document.isATOn ? "visible" : "hidden", display: this.props.Document.isATOn ? "flex" : "none" }} placeholder={String(Math.floor(this._time) / 1000) + " s"} ref={this._timeInputRef} onKeyDown={this.onTimeInput} />
+ <div style={{ width: "100%", display: !this.props.Document.isATOn ? "flex" : "none" }}>Current: {this.getCurrentTime()}</div>
</div>
</div>
</div>
@@ -521,13 +520,22 @@ export class Timeline extends React.Component<FieldViewProps> {
}
}
+ // @computed
+ getCurrentTime = () => {
+ let current = KeyframeFunc.convertPixelTime(this._currentBarX, "mili", "time", this._tickSpacing, this._tickIncrement);
+ // console.log(this._currentBarX)
+ return this.toReadTime(current); ``
+ // return (Math.floor(current) / 1000)
+ // return current / 1000.0;
+ }
+
/**
* 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() {
- // console.log(this.props.PanelWidth());
+ console.log(this.props.Document.isATOn);
runInAction(() => {
this._panelWidth = this.props.PanelWidth();
this.changeLenths();
@@ -545,9 +553,10 @@ export class Timeline extends React.Component<FieldViewProps> {
<div key="timeline_scrubberhead" className="scrubberhead" onPointerDown={this.onScrubberDown} ></div>
</div>
<div key="timeline_trackbox" className="trackbox" ref={this._trackbox} onPointerDown={this.onPanDown} style={{ width: `${this._totalLength}px` }}>
- {DocListCast(this.children).map(doc => <Track 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={this._timelineVisible}/>)}
+ {DocListCast(this.children).map(doc => <Track 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={this._timelineVisible} />)}
</div>
</div>
+ <div className="currentTime">Current: {this.getCurrentTime()}</div>
<div key="timeline_title" className="title-container" ref={this._titleContainer}>
{DocListCast(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>)}
</div>
diff --git a/src/client/views/animationtimeline/TimelineOverview.scss b/src/client/views/animationtimeline/TimelineOverview.scss
index a0b9d462b..283163ea7 100644
--- a/src/client/views/animationtimeline/TimelineOverview.scss
+++ b/src/client/views/animationtimeline/TimelineOverview.scss
@@ -8,6 +8,13 @@ $timelineDark: #77a1aa;
margin-right: 10px;
}
+.timeline-flex {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+}
+
.timeline-overview-container {
// padding: 0px;
margin-right: 5px;
@@ -93,7 +100,7 @@ $timelineDark: #77a1aa;
height: 4px;
width: 0px;
z-index: 1000;
- background-color: $timelineColor;
+ background-color: $timelineDark;
border-radius: 20px;
margin-top: -4px;
cursor: pointer;
diff --git a/src/client/views/animationtimeline/TimelineOverview.tsx b/src/client/views/animationtimeline/TimelineOverview.tsx
index 553ba890d..7ff78955e 100644
--- a/src/client/views/animationtimeline/TimelineOverview.tsx
+++ b/src/client/views/animationtimeline/TimelineOverview.tsx
@@ -4,6 +4,7 @@ import { observer } from "mobx-react";
import "./TimelineOverview.scss";
import * as $ from 'jquery';
import { Timeline } from "./Timeline";
+import { Keyframe, KeyframeFunc } from "./Keyframe";
interface TimelineOverviewProps {
@@ -15,7 +16,9 @@ interface TimelineOverviewProps {
parent: Timeline;
changeCurrentBarX: (pixel: number) => void;
movePanX: (pixel: number) => any;
- panelWidth: number;
+ time: number;
+ tickSpacing: number;
+ tickIncrement: number;
}
@@ -25,7 +28,9 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
@observable private _scrubberRef = React.createRef<HTMLDivElement>();
@observable private overviewBarWidth: number = 0;
@observable private _authoringReaction?: IReactionDisposer;
- @observable private _resizeReaction?: IReactionDisposer;
+ @observable private visibleTime: number = 0;
+ @observable private currentX: number = 0;
+ @observable private visibleStart: number = 0;
private readonly DEFAULT_HEIGHT = 50;
private readonly DEFAULT_WIDTH = 300;
@@ -42,29 +47,20 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
}
},
);
- // this._resizeReaction = reaction(
- // () => this.props.parent.props.PanelWidth,
- // () => {
- // // if (!this.props.parent._isAuthoring) {
- // // runInAction(() => {
- // console.log("resizing");
- // this.setOverviewWidth();
- // // });
- // // }
- // },
- // );
}
componentWillUnmount = () => {
this._authoringReaction && this._authoringReaction();
- this._resizeReaction && this._resizeReaction();
}
@action
setOverviewWidth() {
let width = $("#timelineOverview").width();
+ // console.log($("timelineOverview"))
if (width) this.overviewBarWidth = width;
else this.overviewBarWidth = 0;
+
+ // console.log(this.overviewBarWidth)
}
@action
@@ -85,8 +81,6 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
// let movX = (this.props.visibleStart / this.props.totalLength) * (this.overviewWidth) + e.movementX;
this.props.movePanX((movX / (this.DEFAULT_WIDTH)) * this.props.totalLength);
// this.props.movePanX((movX / (this.overviewWidth) * this.props.totalLength);
-
- // console.log(this.props.totalLength);
}
@action
@@ -125,16 +119,30 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
document.removeEventListener("pointerup", this.onScrubberUp);
}
+ @action
+ getTimes() {
+ let vis = KeyframeFunc.convertPixelTime(this.props.visibleLength, "mili", "time", this.props.tickSpacing, this.props.tickIncrement);
+ let x = KeyframeFunc.convertPixelTime(this.props.currentBarX, "mili", "time", this.props.tickSpacing, this.props.tickIncrement);
+ let start = KeyframeFunc.convertPixelTime(this.props.visibleStart, "mili", "time", this.props.tickSpacing, this.props.tickIncrement);
+ this.visibleTime = vis;
+ this.currentX = x;
+ this.visibleStart = start;
+ // console.log("getting times")
+ // console.log(x)
+ // console.log(start)
+ }
+
render() {
+ this.setOverviewWidth();
+ this.getTimes();
- // calculates where everything should fall based on its size
- let percentVisible = this.props.visibleLength / this.props.totalLength;
+ let percentVisible = this.visibleTime / this.props.time;
let visibleBarWidth = percentVisible * this.overviewBarWidth;
- let percentScrubberStart = this.props.currentBarX / this.props.totalLength;
+ let percentScrubberStart = this.currentX / this.props.time;
let scrubberStart = percentScrubberStart * this.overviewBarWidth;
- let percentBarStart = this.props.visibleStart / this.props.totalLength;
+ let percentBarStart = this.visibleStart / this.props.time;
let barStart = percentBarStart * this.overviewBarWidth;
let timeline = this.props.isAuthoring ? [
@@ -152,8 +160,10 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
<div className="timeline-play-tail" style={{ width: `${(this.props.currentBarX / this.props.totalLength) * 294}px` }}></div>
];
return (
- <div className="timelineOverview-bounding">
- {timeline}
+ <div className="timeline-flex">
+ <div className="timelineOverview-bounding">
+ {timeline}
+ </div>
</div>
);
}
diff --git a/src/client/views/animationtimeline/Track.scss b/src/client/views/animationtimeline/Track.scss
index 61a8e0b88..aec587a79 100644
--- a/src/client/views/animationtimeline/Track.scss
+++ b/src/client/views/animationtimeline/Track.scss
@@ -1,14 +1,15 @@
-@import "./../globalCssVariables.scss";
+@import "./../globalCssVariables.scss";
-.track-container{
+.track-container {
.track {
- .inner {
- top:0px;
- width: calc(100%);
- background-color: $light-color;
- border: 1px solid $dark-color;
- position:relative;
+ .inner {
+ top: 0px;
+ width: calc(100%);
+ background-color: $light-color;
+ border: 1px solid $dark-color;
+ position: relative;
+ z-index: 100;
}
}
} \ No newline at end of file
diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index 287e4a04f..84edc6e0a 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -51,7 +51,7 @@ export class Track extends React.Component<IProps> {
runInAction(() => {
if (!this.props.node.regions) this.props.node.regions = new List<Doc>(); //if there is no region, then create new doc to store stuff
//these two lines are exactly same from timeline.tsx
- let relativeHeight = window.innerHeight / 14;
+ let relativeHeight = window.innerHeight / 20;
this._trackHeight = relativeHeight < this.MAX_TITLE_HEIGHT ? relativeHeight : this.MAX_TITLE_HEIGHT; //for responsiveness
});
}