diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html | 1 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 57 |
2 files changed, 47 insertions, 11 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html index 19709ca7..8ddc81cd 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html | |||
@@ -31,6 +31,7 @@ | |||
31 | "container_tracks" : {"#" : "container-tracks"}, | 31 | "container_tracks" : {"#" : "container-tracks"}, |
32 | "end_hottext" : {"@" : "endHottext"}, | 32 | "end_hottext" : {"@" : "endHottext"}, |
33 | "container_layers" : {"#" : "container-layers"}, | 33 | "container_layers" : {"#" : "container-layers"}, |
34 | "container_tracks" : {"#" : "container-tracks"}, | ||
34 | "timeline_disabler" : {"#" : "timeline-disabler"}, | 35 | "timeline_disabler" : {"#" : "timeline-disabler"}, |
35 | "checkable_relative" : {"#" : "checkable_relative"}, | 36 | "checkable_relative" : {"#" : "checkable_relative"}, |
36 | "checkable_absolute" : {"#" : "checkable_absolute"}, | 37 | "checkable_absolute" : {"#" : "checkable_absolute"}, |
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index d1cab096..1ce627b7 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -177,7 +177,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
177 | }, | 177 | }, |
178 | set:function (val) { | 178 | set:function (val) { |
179 | this._masterDuration = val; | 179 | this._masterDuration = val; |
180 | this.timebar.style.width = (this._masterDuration / 12) + "px"; | 180 | var intDur = Math.round(val/12), |
181 | strWidth = intDur + "px"; | ||
182 | this.timebar.style.width = strWidth; | ||
181 | } | 183 | } |
182 | }, | 184 | }, |
183 | 185 | ||
@@ -329,6 +331,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
329 | useAbsolutePosition:{ | 331 | useAbsolutePosition:{ |
330 | value:true | 332 | value:true |
331 | }, | 333 | }, |
334 | _currentDocumentUuid: { | ||
335 | value: false | ||
336 | }, | ||
337 | _ignoreSelectionChanges: { | ||
338 | value: false | ||
339 | }, | ||
332 | /* === END: Models === */ | 340 | /* === END: Models === */ |
333 | /* === BEGIN: Draw cycle === */ | 341 | /* === BEGIN: Draw cycle === */ |
334 | prepareForDraw:{ | 342 | prepareForDraw:{ |
@@ -344,6 +352,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
344 | this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); | 352 | this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); |
345 | this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); | 353 | this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); |
346 | this.container_layers.addEventListener("dragover", this.handleLayerDragover.bind(this), false); | 354 | this.container_layers.addEventListener("dragover", this.handleLayerDragover.bind(this), false); |
355 | //this.container_tracks.addEventListener("dragover", this.handleKeyframeDragover.bind(this), false); | ||
347 | this.container_layers.addEventListener("drop", this.handleLayerDrop.bind(this), false); | 356 | this.container_layers.addEventListener("drop", this.handleLayerDrop.bind(this), false); |
348 | 357 | ||
349 | // Bind the handlers for the config menu | 358 | // Bind the handlers for the config menu |
@@ -584,6 +593,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
584 | this.drawTimeMarkers(); | 593 | this.drawTimeMarkers(); |
585 | // Document switching | 594 | // Document switching |
586 | // Check to see if we have saved timeline information in the currentDocument. | 595 | // Check to see if we have saved timeline information in the currentDocument. |
596 | //console.log("TimelinePanel.initTimelineForDocument"); | ||
597 | |||
587 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { | 598 | if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { |
588 | //console.log('TimelinePanel.initTimelineForDocument: new Document'); | 599 | //console.log('TimelinePanel.initTimelineForDocument: new Document'); |
589 | // No, we have no information stored. | 600 | // No, we have no information stored. |
@@ -609,12 +620,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
609 | // Draw the repetition. | 620 | // Draw the repetition. |
610 | this.arrLayers = this.temparrLayers; | 621 | this.arrLayers = this.temparrLayers; |
611 | this.currentLayerNumber = this.arrLayers.length; | 622 | this.currentLayerNumber = this.arrLayers.length; |
623 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; | ||
612 | boolAlreadyInitialized = true; | 624 | boolAlreadyInitialized = true; |
613 | 625 | ||
614 | } else if (this.application.ninja.currentDocument.setLevel) { | 626 | } else if (this.application.ninja.currentDocument.setLevel) { |
615 | //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); | 627 | //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); |
616 | // Information stored, but we're moving up or down in the breadcrumb. | 628 | // Information stored, but we're moving up or down in the breadcrumb. |
617 | // Get the current selection and restore timeline info for its children. | 629 | // Get the current selection and restore timeline info for its children. |
630 | //debugger; | ||
618 | var parentNode = this.application.ninja.currentSelectedContainer, | 631 | var parentNode = this.application.ninja.currentSelectedContainer, |
619 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 632 | storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
620 | this.temparrLayers = []; | 633 | this.temparrLayers = []; |
@@ -650,6 +663,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
650 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; | 663 | this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; |
651 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; | 664 | this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; |
652 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; | 665 | this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; |
666 | this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; | ||
653 | 667 | ||
654 | 668 | ||
655 | //debugger; | 669 | //debugger; |
@@ -699,23 +713,32 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
699 | this._openDoc = false; | 713 | this._openDoc = false; |
700 | this.end_hottext.value = 25; | 714 | this.end_hottext.value = 25; |
701 | this.updateTrackContainerWidth(); | 715 | this.updateTrackContainerWidth(); |
702 | this.masterDuration = 0; | ||
703 | // Clear the repetitions | 716 | // Clear the repetitions |
704 | if (this.arrLayers.length > 0) { | 717 | if (this.arrLayers.length > 0) { |
705 | this.arrLayers = []; | 718 | this.arrLayers = []; |
706 | this.arrLayers.length = 0; | 719 | this.arrLayers.length = 0; |
707 | } | 720 | } |
721 | this.resetMasterDuration(); | ||
708 | } | 722 | } |
709 | }, | 723 | }, |
710 | 724 | ||
711 | handleDocumentChange:{ | 725 | handleDocumentChange:{ |
712 | value:function () { | 726 | value:function () { |
727 | // console.log("TimelinePanel.handleDocumentChange"); | ||
728 | |||
713 | if (this.application.ninja.currentDocument == null) { | 729 | if (this.application.ninja.currentDocument == null) { |
714 | // On app initialization, the binding is triggered before | 730 | // On app initialization, the binding is triggered before |
715 | // there is a currentDocument. We don't do anything at that time. | 731 | // there is a currentDocument. We don't do anything at that time. |
716 | return; | 732 | return; |
717 | } | 733 | } |
718 | // this.application.ninja.currentDocument.setLevel = true; | 734 | |
735 | // Is this the same document? | ||
736 | if (this._currentDocumentUuid === this.application.ninja.currentDocument.uuid) { | ||
737 | // Yes, same document, so we are changing levels. | ||
738 | this.application.ninja.currentDocument.setLevel = true; | ||
739 | this._ignoreSelectionChanges = true; | ||
740 | } | ||
741 | |||
719 | this._boolCacheArrays = false; | 742 | this._boolCacheArrays = false; |
720 | this.clearTimelinePanel(); | 743 | this.clearTimelinePanel(); |
721 | this._boolCacheArrays = true; | 744 | this._boolCacheArrays = true; |
@@ -799,15 +822,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
799 | arrLayersLength = this.arrLayers.length, | 822 | arrLayersLength = this.arrLayers.length, |
800 | intNumSelected = this.application.ninja.selectedElements.length, | 823 | intNumSelected = this.application.ninja.selectedElements.length, |
801 | checkIndex = 0; | 824 | checkIndex = 0; |
802 | 825 | ||
803 | this.deselectTweens(); | 826 | //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected) |
804 | //console.log("TimelinePanel.handleSelectionChange") | 827 | |
805 | if (intNumSelected === 0) { | 828 | if (intNumSelected === 0) { |
806 | this.selectLayers([]); | 829 | if (this._ignoreSelectionChanges !== true) { |
830 | this.selectLayers([]); | ||
831 | } else { | ||
832 | this._ignoreSelectionChanges = false; | ||
833 | } | ||
834 | |||
807 | this.currentLayerSelected = false; | 835 | this.currentLayerSelected = false; |
808 | this.currentLayersSelected = false; | 836 | this.currentLayersSelected = false; |
809 | } | 837 | } |
810 | 838 | ||
811 | if (intNumSelected === 1) { | 839 | if (intNumSelected === 1) { |
812 | this.currentLayersSelected = false; | 840 | this.currentLayersSelected = false; |
813 | if (this.application.ninja.selectedElements[0]) { | 841 | if (this.application.ninja.selectedElements[0]) { |
@@ -858,7 +886,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
858 | 886 | ||
859 | //console.log(arrSelectedIndexes); | 887 | //console.log(arrSelectedIndexes); |
860 | 888 | ||
861 | 889 | ||
862 | if (this.selectedKeyframes) { | 890 | if (this.selectedKeyframes) { |
863 | this.deselectTweens(); | 891 | this.deselectTweens(); |
864 | } | 892 | } |
@@ -867,8 +895,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
867 | this.arrLayers[i].layerData.isSelected = false; | 895 | this.arrLayers[i].layerData.isSelected = false; |
868 | this.triggerLayerBinding(i); | 896 | this.triggerLayerBinding(i); |
869 | } | 897 | } |
870 | 898 | ||
871 | this.currentLayersSelected = false; | 899 | if (this.currentLayersSelected !== false) { |
900 | this.currentLayersSelected = false; | ||
901 | } | ||
872 | if (arrSelectedIndexesLength > 0) { | 902 | if (arrSelectedIndexesLength > 0) { |
873 | this.currentLayersSelected = []; |