aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/animationtimeline/Track.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/animationtimeline/Track.tsx')
-rw-r--r--src/client/views/animationtimeline/Track.tsx24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index 1e4ed74be..dea7b6aae 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -1,4 +1,4 @@
-import { action, computed, intercept, makeObservable, observable, reaction, runInAction } from 'mobx';
+import { action, computed, intercept, IReactionDisposer, makeObservable, observable, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Doc, DocListCast, DocListCastAsync, Opt } from '../../../fields/Doc';
@@ -6,7 +6,7 @@ import { Copy } from '../../../fields/FieldSymbols';
import { List } from '../../../fields/List';
import { ObjectField } from '../../../fields/ObjectField';
import { listSpec } from '../../../fields/Schema';
-import { Cast, NumCast } from '../../../fields/Types';
+import { Cast, DocCast, NumCast } from '../../../fields/Types';
import { Transform } from '../../util/Transform';
import { ObservableReactComponent } from '../ObservableReactComponent';
import { Region, RegionData, RegionHelpers } from './Region';
@@ -29,16 +29,16 @@ interface IProps {
@observer
export class Track extends ObservableReactComponent<IProps> {
@observable private _inner = React.createRef<HTMLDivElement>();
- @observable private _currentBarXReaction: any = undefined;
- @observable private _timelineVisibleReaction: any = undefined;
- @observable private _autoKfReaction: any = undefined;
+ @observable private _currentBarXReaction: IReactionDisposer | undefined = undefined;
+ @observable private _timelineVisibleReaction: IReactionDisposer | undefined = undefined;
+ @observable private _autoKfReaction: IReactionDisposer | undefined = undefined;
@observable private _newKeyframe: boolean = false;
private readonly MAX_TITLE_HEIGHT = 75;
@observable private _trackHeight = 0;
private primitiveWhitelist = ['x', 'y', '_freeform_panX', '_freeform_panY', '_width', '_height', '_rotation', 'opacity', '_layout_scrollTop'];
private objectWhitelist = ['data'];
- constructor(props: any) {
+ constructor(props: IProps) {
super(props);
makeObservable(this);
}
@@ -101,11 +101,11 @@ export class Track extends ObservableReactComponent<IProps> {
}
const keyframes = Cast(this.saveStateRegion.keyframes, listSpec(Doc)) as List<Doc>;
const kfIndex = keyframes.indexOf(this.saveStateKf);
- const kf = keyframes[kfIndex] as Doc; //index in the keyframe
+ const kf = DocCast(keyframes[kfIndex]); //index in the keyframe
if (this._newKeyframe) {
- DocListCast(this.saveStateRegion.keyframes).forEach((kf, index) => {
- this.copyDocDataToKeyFrame(kf);
- kf.opacity = index === 0 || index === 3 ? 0.1 : 1;
+ DocListCast(this.saveStateRegion.keyframes).forEach((keyF, index) => {
+ this.copyDocDataToKeyFrame(keyF);
+ keyF.opacity = index === 0 || index === 3 ? 0.1 : 1;
});
this._newKeyframe = false;
}
@@ -144,7 +144,7 @@ export class Track extends ObservableReactComponent<IProps> {
() => {
return [...this.primitiveWhitelist.map(key => this._props.animatedDoc[key]), ...objects];
},
- (changed, reaction) => {
+ (/* changed, reaction */) => {
//check for region
const region = this.findRegion(this.time);
if (region !== undefined) {
@@ -374,7 +374,7 @@ export class Track extends ObservableReactComponent<IProps> {
@action
copyDocDataToKeyFrame = (doc: Doc) => {
- var somethingChanged = false;
+ let somethingChanged = false;
this.primitiveWhitelist.map(key => {
const originalVal = this._props.animatedDoc[key];
somethingChanged = somethingChanged || originalVal !== doc[key];