diff options
author | andrewdkim <adkim414@gmail.com> | 2019-07-11 16:30:56 -0400 |
---|---|---|
committer | andrewdkim <adkim414@gmail.com> | 2019-07-11 16:30:56 -0400 |
commit | 35c4b9245e6da40e2f6dd26be6e949640883f677 (patch) | |
tree | 40b2b28d7ed627fff88a41813fbd699b7fd80c7a /src/client/views/nodes/Keyframe.tsx | |
parent | c206384e34ea22dfdfe05a873531b7710c88d1c3 (diff) |
bug fixes
Diffstat (limited to 'src/client/views/nodes/Keyframe.tsx')
-rw-r--r-- | src/client/views/nodes/Keyframe.tsx | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/src/client/views/nodes/Keyframe.tsx b/src/client/views/nodes/Keyframe.tsx index 9be1d9ed2..d992b1c44 100644 --- a/src/client/views/nodes/Keyframe.tsx +++ b/src/client/views/nodes/Keyframe.tsx @@ -92,14 +92,7 @@ export class Keyframe extends React.Component<IProps> { @computed private get regions() { return Cast(this.props.node.regions, listSpec(Doc)) as List<Doc>; - } - - - @observable fadeIn = new Doc(); - @observable fadeOut = new Doc(); - @observable start = new Doc(); - @observable finish = new Doc(); - + } @action componentDidMount() { @@ -111,40 +104,24 @@ export class Keyframe extends React.Component<IProps> { (fadeOut.key! as Doc).opacity = 1; (start.key! as Doc).opacity = 0.1; (finish.key! as Doc).opacity = 0.1; - let fadeInIndex = this.regiondata.keyframes!.indexOf(fadeIn); - let fadeOutIndex = this.regiondata.keyframes!.indexOf(fadeOut); - let startIndex = this.regiondata.keyframes!.indexOf(start); - let finishIndex = this.regiondata.keyframes!.indexOf(finish); - this.regiondata.keyframes![fadeInIndex] =fadeIn; - this.regiondata.keyframes![fadeOutIndex] =fadeOut; - this.regiondata.keyframes![startIndex] = start; - this.regiondata.keyframes![finishIndex] =finish; - - this.fadeIn = fadeIn; - this.fadeOut = fadeOut; - this.start = start; - this.finish = finish; - observe(this.regiondata, change => { if (change.type === "update"){ - console.log("updated"); - this.fadeIn.time = this.regiondata.position + this.regiondata.fadeIn; - this.fadeOut.time = this.regiondata.position + this.regiondata.duration - this.regiondata.fadeOut; - this.start.time = this.regiondata.position; - this.finish.time = this.regiondata.position + this.regiondata.duration; - - let fadeInIndex = this.regiondata.keyframes!.indexOf(this.fadeIn); - let fadeOutIndex = this.regiondata.keyframes!.indexOf(this.fadeOut); - let startIndex = this.regiondata.keyframes!.indexOf(this.start); - let finishIndex = this.regiondata.keyframes!.indexOf(this.finish); + fadeIn.time = this.regiondata.position + this.regiondata.fadeIn; + fadeOut.time = this.regiondata.position + this.regiondata.duration - this.regiondata.fadeOut; + start.time = this.regiondata.position; + finish.time = this.regiondata.position + this.regiondata.duration; + + let fadeInIndex = this.regiondata.keyframes!.indexOf(fadeIn); + let fadeOutIndex = this.regiondata.keyframes!.indexOf(fadeOut); + let startIndex = this.regiondata.keyframes!.indexOf(start); + let finishIndex = this.regiondata.keyframes!.indexOf(finish); - this.regiondata.keyframes![fadeInIndex] = this.fadeIn; - this.regiondata.keyframes![fadeOutIndex] = this.fadeOut; - this.regiondata.keyframes![startIndex] = this.start; - this.regiondata.keyframes![finishIndex] = this.finish; + this.regiondata.keyframes![fadeInIndex] = fadeIn; + this.regiondata.keyframes![fadeOutIndex] = fadeOut; + this.regiondata.keyframes![startIndex] = start; + this.regiondata.keyframes![finishIndex] = finish; - this.forceUpdate(); } }); @@ -158,10 +135,6 @@ export class Keyframe extends React.Component<IProps> { } - - - - @action makeKeyData = (kfpos: number, type:KeyframeFunc.KeyframeType = KeyframeFunc.KeyframeType.new) => { //Kfpos is mouse offsetX, representing time let hasData = false; @@ -174,8 +147,9 @@ export class Keyframe extends React.Component<IProps> { if (!hasData) { let TK: Doc = new Doc(); TK.time = kfpos; + console.log(kfpos + " from makeKeyDat"); if (type === KeyframeFunc.KeyframeType.fade){ - TK.key = new Doc(); + TK.key = Doc.MakeAlias(this.props.node); } else { TK.key = Doc.MakeCopy(this.props.node, true); console.log(toJS(TK.key)); |