diff options
| author | andrewdkim <adkim414@gmail.com> | 2019-09-17 18:01:36 -0400 |
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2019-09-17 18:01:36 -0400 |
| commit | 53c4f6ddad5534101d7a7482332cddb02ba99c21 (patch) | |
| tree | 8433f319e5ff8de1db9f22599f9ea33b3d783257 /src/client/views/animationtimeline | |
| parent | cd052ac6bd318a0569c66ca1fba684b7dbdaaca9 (diff) | |
zoom, contextmenu fix
Diffstat (limited to 'src/client/views/animationtimeline')
| -rw-r--r-- | src/client/views/animationtimeline/Timeline.tsx | 7 | ||||
| -rw-r--r-- | src/client/views/animationtimeline/TimelineMenu.tsx | 6 | ||||
| -rw-r--r-- | src/client/views/animationtimeline/Track.tsx | 6 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx index 187c9396d..c50ffa51b 100644 --- a/src/client/views/animationtimeline/Timeline.tsx +++ b/src/client/views/animationtimeline/Timeline.tsx @@ -352,11 +352,14 @@ export class Timeline extends React.Component<FieldViewProps> { e.preventDefault(); e.stopPropagation(); let offset = e.clientX - this._infoContainer.current!.getBoundingClientRect().left; - let prevTime = KeyframeFunc.convertPixelTime(this._visibleStart + offset, "mili", "time", this._tickSpacing, this._tickIncrement); + let prevTime = KeyframeFunc.convertPixelTime(this._visibleStart + offset, "mili", "time", this._tickSpacing, this._tickIncrement); + let prevCurrent = KeyframeFunc.convertPixelTime(this._currentBarX,"mili", "time", this._tickSpacing, this._tickIncrement); e.deltaY < 0 ? this.zoom(true) : this.zoom(false); let currPixel = KeyframeFunc.convertPixelTime(prevTime, "mili", "pixel", this._tickSpacing, this._tickIncrement); + let currCurrent = KeyframeFunc.convertPixelTime(prevCurrent, "mili", "pixel", this._tickSpacing, this._tickIncrement); this._infoContainer.current!.scrollLeft = currPixel - offset; - this._visibleStart = currPixel - offset; + this._visibleStart = currPixel - offset; + this.changeCurrentBarX(currCurrent); } @action diff --git a/src/client/views/animationtimeline/TimelineMenu.tsx b/src/client/views/animationtimeline/TimelineMenu.tsx index 572b35b90..1fd97c6c1 100644 --- a/src/client/views/animationtimeline/TimelineMenu.tsx +++ b/src/client/views/animationtimeline/TimelineMenu.tsx @@ -44,12 +44,16 @@ export class TimelineMenu extends React.Component { document.addEventListener("keypress", (e:KeyboardEvent) => { if (e.keyCode === 13) { event(text); + this.closeMenu(); } }); }}/></div>); } else if (type === "button") { let buttonRef = React.createRef<HTMLDivElement>(); - this._currentMenu.push( <div className="timeline-menu-item"><FontAwesomeIcon icon={faChartLine}size="lg"/><p className="timeline-menu-desc" onClick={event}>{title}</p></div>); + this._currentMenu.push( <div className="timeline-menu-item"><FontAwesomeIcon icon={faChartLine}size="lg"/><p className="timeline-menu-desc" onClick={(e) => { + event(e); + this.closeMenu(); + }}>{title}</p></div>); } } diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx index e99da6648..89533c4df 100644 --- a/src/client/views/animationtimeline/Track.tsx +++ b/src/client/views/animationtimeline/Track.tsx @@ -53,10 +53,6 @@ export class Track extends React.Component<IProps> { if (this.regions.length === 0) this.createRegion(KeyframeFunc.convertPixelTime(this.props.currentBarX, "mili", "time", this.props.tickSpacing, this.props.tickIncrement)); this.props.node.hidden = false; this.props.node.opacity = 1; - let state = new Doc(); - state.key = Doc.MakeCopy(await this.props.node, true); - console.log(this.props.node.x); - this._storedState = state; }); } @@ -101,7 +97,7 @@ export class Track extends React.Component<IProps> { @action revertState = () => { let copyDoc = Doc.MakeCopy(this.props.node, true); - this.applyKeys(this._storedState!); + if (this._storedState) this.applyKeys(this._storedState); let newState = new Doc(); newState.key = copyDoc; this._storedState = newState; |
