aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/animationtimeline/TimelineOverview.tsx
diff options
context:
space:
mode:
authormonikahedman <monika_hedman@brown.edu>2020-02-10 20:38:37 -0500
committermonikahedman <monika_hedman@brown.edu>2020-02-10 20:38:37 -0500
commit77ddee9b0d5697522894badc9df1d54a0a7f08c9 (patch)
tree3ada81eb9cf1ccc0d351fff877ab3acac069ca30 /src/client/views/animationtimeline/TimelineOverview.tsx
parentd9990be832185b31375aaeb458c21addb389c32e (diff)
fixed width
Diffstat (limited to 'src/client/views/animationtimeline/TimelineOverview.tsx')
-rw-r--r--src/client/views/animationtimeline/TimelineOverview.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/animationtimeline/TimelineOverview.tsx b/src/client/views/animationtimeline/TimelineOverview.tsx
index a587e1138..e3a276737 100644
--- a/src/client/views/animationtimeline/TimelineOverview.tsx
+++ b/src/client/views/animationtimeline/TimelineOverview.tsx
@@ -26,6 +26,8 @@ interface TimelineOverviewProps {
export class TimelineOverview extends React.Component<TimelineOverviewProps>{
@observable private _visibleRef = React.createRef<HTMLDivElement>();
@observable private _scrubberRef = React.createRef<HTMLDivElement>();
+ @observable private authoringContainer = React.createRef<HTMLDivElement>();
+ @observable private playbackContainer = React.createRef<HTMLDivElement>();
@observable private overviewBarWidth: number = 0;
@observable private playbarWidth: number = 0;
@observable private activeOverviewWidth: number = 0;
@@ -57,8 +59,8 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
@action
setOverviewWidth() {
- const width1 = $("#timelineOverview").width();
- const width2 = $("#timelinePlay").width();
+ const width1 = this.authoringContainer.current?.clientWidth;
+ const width2 = this.playbackContainer.current?.clientWidth;
if (width1 && width1 !== 0) this.overviewBarWidth = width1;
if (width2 && width2 !== 0) this.playbarWidth = width2;
@@ -143,24 +145,24 @@ export class TimelineOverview extends React.Component<TimelineOverviewProps>{
const percentScrubberStart = this.currentX / this.props.time;
let scrubberStart = this.props.currentBarX / this.props.totalLength * this.activeOverviewWidth;
- if (scrubberStart > this.activeOverviewWidth) scrubberStart = this.activeOverviewWidth;
+ if (scrubberStart > this.activeOverviewWidth) scrubberStart = this.activeOverviewWidth;
const percentBarStart = this.visibleStart / this.props.time;
const barStart = percentBarStart * this.activeOverviewWidth;
- let playWidth = (this.props.currentBarX / this.props.totalLength) * this.activeOverviewWidth;
- if (playWidth > this.activeOverviewWidth) playWidth = this.activeOverviewWidth;
+ let playWidth = (this.props.currentBarX / this.props.totalLength) * this.activeOverviewWidth;
+ if (playWidth > this.activeOverviewWidth) playWidth = this.activeOverviewWidth;
const timeline = this.props.isAuthoring ? [
- <div key="timeline-overview-container" className="timeline-overview-container overviewBar" id="timelineOverview">
+ <div key="timeline-overview-container" className="timeline-overview-container overviewBar" id="timelineOverview" ref={this.authoringContainer}>
<div ref={this._visibleRef} key="timeline-overview-visible" className="timeline-overview-visible" style={{ left: `${barStart}px`, width: `${visibleBarWidth}px` }} onPointerDown={this.onPointerDown}></div>,
<div ref={this._scrubberRef} key="timeline-overview-scrubber-container" className="timeline-overview-scrubber-container" style={{ left: `${scrubberStart}px` }} onPointerDown={this.onScrubberDown}>
<div key="timeline-overview-scrubber-head" className="timeline-overview-scrubber-head"></div>
</div>
</div>
] : [
- <div key="timeline-play-container" className="timeline-play-bar overviewBar" id="timelinePlay">
+ <div key="timeline-play-container" className="timeline-play-bar overviewBar" id="timelinePlay" ref={this.playbackContainer}>
<div ref={this._scrubberRef} className="timeline-play-head" style={{ left: `${scrubberStart}px` }} onPointerDown={this.onScrubberDown}></div>
</div>,
<div className="timeline-play-tail" style={{ width: `${playWidth}px` }}></div>