diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 168 |
1 files changed, 101 insertions, 67 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 6066066a..8dc19958 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -321,6 +321,19 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
321 | } | 321 | } |
322 | }, | 322 | }, |
323 | 323 | ||
324 | _ruleList:{ | ||
325 | value:[] | ||
326 | }, | ||
327 | |||
328 | ruleList:{ | ||
329 | get:function () { | ||
330 | return this._ruleList; | ||
331 | }, | ||
332 | set:function (val) { | ||
333 | this._ruleList = val; | ||
334 | } | ||
335 | }, | ||
336 | |||
324 | animationNamesString:{ | 337 | animationNamesString:{ |
325 | value:"" | 338 | value:"" |
326 | }, | 339 | }, |
@@ -440,11 +453,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
440 | 453 | ||
441 | triggerOutgoingBinding : { | 454 | triggerOutgoingBinding : { |
442 | value: function() { | 455 | value: function() { |
443 | if (this.trackData.triggerBinding === true) { | 456 | this.trackData.triggerBinding = !this.trackData.triggerBinding; |
444 | this.trackData.triggerBinding = false; | ||
445 | } else { | ||
446 | this.trackData.triggerBinding = true; | ||
447 | } | ||
448 | } | 457 | } |
449 | }, | 458 | }, |
450 | 459 | ||
@@ -468,8 +477,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
468 | this.ninjaStylesContoller = this.application.ninja.stylesController; | 477 | this.ninjaStylesContoller = this.application.ninja.stylesController; |
469 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 478 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
470 | if (selectedIndex !== false) { | 479 | if (selectedIndex !== false) { |
471 | if(this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList[0]){ | 480 | if(this.application.ninja.timeline.arrLayers[selectedIndex].layerData.stageElement){ |
472 | this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList[0]; | 481 | this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].layerData.stageElement; |
473 | } | 482 | } |
474 | } | 483 | } |
475 | 484 | ||
@@ -514,7 +523,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
514 | didDraw:{ | 523 | didDraw:{ |
515 | value:function () { | 524 | value:function () { |
516 | if ((!this.application.ninja.documentController.creatingNewFile)||(!this.application.ninja.currentDocument.setLevel)) { | 525 | if ((!this.application.ninja.documentController.creatingNewFile)||(!this.application.ninja.currentDocument.setLevel)) { |
517 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { | 526 | if (this.application.ninja.currentDocument.model.documentRoot.children[0]) { |
518 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 527 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
519 | if (selectedIndex !== false) { | 528 | if (selectedIndex !== false) { |
520 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { | 529 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { |
@@ -597,7 +606,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
597 | // This needs to move to a keyboard shortcut that is TBD | 606 | // This needs to move to a keyboard shortcut that is TBD |
598 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 607 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
599 | if (ev.shiftKey) { | 608 | if (ev.shiftKey) { |
600 | if (this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList.length == 1) { | 609 | //if (this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList.length == 1) { |
601 | if (this.tweens.length < 1) { | 610 | if (this.tweens.length < 1) { |
602 | this.insertTween(0); | 611 | this.insertTween(0); |
603 | this.addAnimationRuleToElement(ev); | 612 | this.addAnimationRuleToElement(ev); |
@@ -612,10 +621,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
612 | this.updateKeyframeRule(); | 621 | this.updateKeyframeRule(); |
613 | } | 622 | } |
614 | } | 623 | } |
615 | } else { | 624 | //} else { |
616 | // TEMP error check | 625 | // TEMP error check |
617 | console.log("There must be exactly one element in an animated layer."); | 626 | //console.log("There must be exactly one element in an animated layer."); |
618 | } | 627 | //} |
619 | } | 628 | } |
620 | } | 629 | } |
621 | }, | 630 | }, |
@@ -644,17 +653,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
644 | newTween.tweenData = {}; | 653 | newTween.tweenData = {}; |
645 | 654 | ||
646 | if (clickPos == 0) { | 655 | if (clickPos == 0) { |
647 | this.animatedElement = this.application.ninja.timeline.currentLayerSelected.layerData.elementsList[0]; | 656 | this.animatedElement = this.application.ninja.timeline.arrLayers[this.application.ninja.timeline.currentLayersSelected[0]].layerData.stageElement; |
648 | newTween.tweenData.spanWidth = 0; | 657 | newTween.tweenData.spanWidth = 0; |
649 | newTween.tweenData.keyFramePosition = 0; | 658 | newTween.tweenData.keyFramePosition = 0; |
650 | newTween.tweenData.keyFrameMillisec = 0; | 659 | newTween.tweenData.keyFrameMillisec = 0; |
651 | newTween.tweenData.tweenID = 0; | 660 | newTween.tweenData.tweenID = 0; |
652 | newTween.tweenData.spanPosition = 0; | 661 | newTween.tweenData.spanPosition = 0; |
653 | newTween.tweenData.tweenedProperties = []; | 662 | newTween.tweenData.tweenedProperties = []; |
654 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; | 663 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px"; |
655 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; | 664 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px"; |
656 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; | 665 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px"; |
657 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; | 666 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px"; |
658 | this.tweens.push(newTween); | 667 | this.tweens.push(newTween); |
659 | } else { | 668 | } else { |
660 | newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; | 669 | newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; |
@@ -663,10 +672,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
663 | newTween.tweenData.tweenID = this.nextKeyframe; | 672 | newTween.tweenData.tweenID = this.nextKeyframe; |
664 | newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; | 673 | newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; |
665 | newTween.tweenData.tweenedProperties = []; | 674 | newTween.tweenData.tweenedProperties = []; |
666 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; | 675 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px"; |
667 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; | 676 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px"; |
668 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; | 677 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px"; |
669 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; | 678 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px"; |
670 | this.tweens.push(newTween); | 679 | this.tweens.push(newTween); |
671 | 680 | ||
672 | // update the animation duration | 681 | // update the animation duration |
@@ -675,7 +684,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
675 | this.nextKeyframe += 1; | 684 | this.nextKeyframe += 1; |
676 | } | 685 | } |
677 | 686 | ||
678 | this.application.ninja.documentController.activeDocument.needsSave = true; | 687 | this.application.ninja.documentController.activeDocument.model.needsSave = true; |
679 | } | 688 | } |
680 | }, | 689 | }, |
681 | 690 | ||
@@ -708,10 +717,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
708 | newTweenToInsert.tweenData.tweenID = splitTweenIndex - 1; | 717 | newTweenToInsert.tweenData.tweenID = splitTweenIndex - 1; |
709 | newTweenToInsert.tweenData.spanPosition = clickPos - newTweenToInsert.tweenData.spanWidth; | 718 | newTweenToInsert.tweenData.spanPosition = clickPos - newTweenToInsert.tweenData.spanWidth; |
710 | newTweenToInsert.tweenData.tweenedProperties = []; | 719 | newTweenToInsert.tweenData.tweenedProperties = []; |
711 | newTweenToInsert.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; | 720 | newTweenToInsert.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px"; |
712 | newTweenToInsert.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; | 721 | newTweenToInsert.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px"; |
713 | newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; | 722 | newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px"; |
714 | newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; | 723 | newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px"; |
715 | this.tweens.splice(splitTweenIndex, 0, newTweenToInsert); | 724 | this.tweens.splice(splitTweenIndex, 0, newTweenToInsert); |
716 | break; | 725 | break; |
717 | } | 726 | } |
@@ -727,41 +736,50 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
727 | 736 | ||
728 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 737 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
729 | this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created=true; | 738 | this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created=true; |
730 | this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].layerData.elementsList[0]; | 739 | this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].layerData.stageElement; |
731 | if(this.animatedElement!==undefined){ | 740 | if(this.animatedElement!==undefined){ |
732 | this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); | 741 | this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); |
733 | 742 | ||
734 | // check for multiple animation names | 743 | // check for multiple animation names |
735 | var animationNameList = this.animationName.split(","); | 744 | var animationNameList = this.animationName.split(","); |
736 | if(animationNameList.length > 1){ | 745 | if(animationNameList.length > 1){ |
746 | this.animationNamesString = this.animationName; | ||
737 | this.animationName = animationNameList[0]; | 747 | this.animationName = animationNameList[0]; |
738 | this.extractKeyframesFromRules(animationNameList); | 748 | this.getAllAnimationRules(animationNameList); |
749 | } else { | ||
750 | this.animationNamesString = this.animationName; | ||
739 | } | 751 | } |
740 | 752 | ||
741 | this.animationNamesString = this.animationName; | ||
742 | |||
743 | // build tweens for this tracks's keyframe rule | 753 | // build tweens for this tracks's keyframe rule |
744 | if(this.animationName){ | 754 | if(this.animationName){ |
745 | trackTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); | 755 | trackTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); |