aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js65
1 files changed, 46 insertions, 19 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index cbd89b47..3fc8eeaf 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -271,6 +271,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
271 _dragLayerID : { 271 _dragLayerID : {
272 value: null 272 value: null
273 }, 273 },
274
275 layersDragged:{
276 value:[],
277 writable:true
278 },
279
274 dragLayerID : { 280 dragLayerID : {
275 get: function() { 281 get: function() {
276 return this._dragLayerID; 282 return this._dragLayerID;
@@ -295,6 +301,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
295 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), 301 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID),
296 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), 302 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
297 dragLayer = this.arrLayers[dragLayerIndex]; 303 dragLayer = this.arrLayers[dragLayerIndex];
304 this.layersDragged.push(dragLayer);
305 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex];
298 306
299 this.arrLayers.splice(dragLayerIndex, 1); 307 this.arrLayers.splice(dragLayerIndex, 1);
300 this.arrLayers.splice(dropLayerIndex, 0, dragLayer); 308 this.arrLayers.splice(dropLayerIndex, 0, dragLayer);
@@ -323,6 +331,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
323 useAbsolutePosition:{ 331 useAbsolutePosition:{
324 value:true 332 value:true
325 }, 333 },
334 _currentDocumentUuid: {
335 value: false
336 },
337 _ignoreSelectionChanges: {
338 value: false
339 },
326 /* === END: Models === */ 340 /* === END: Models === */
327 /* === BEGIN: Draw cycle === */ 341 /* === BEGIN: Draw cycle === */
328 prepareForDraw:{ 342 prepareForDraw:{
@@ -397,6 +411,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
397 this._deleteHelper = false; 411 this._deleteHelper = false;
398 } 412 }
399 } 413 }
414 this.application.ninja.elementMediator.reArrangeDOM(this.layersDragged , this._layerDroppedInPlace);
415 this.layersDragged =[];
400 } 416 }
401 } 417 }
402 }, 418 },
@@ -577,6 +593,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
577 this.drawTimeMarkers(); 593 this.drawTimeMarkers();
578 // Document switching 594 // Document switching
579 // 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
580 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { 598 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) {
581 //console.log('TimelinePanel.initTimelineForDocument: new Document'); 599 //console.log('TimelinePanel.initTimelineForDocument: new Document');
582 // No, we have no information stored. 600 // No, we have no information stored.
@@ -602,12 +620,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
602 // Draw the repetition. 620 // Draw the repetition.
603 this.arrLayers = this.temparrLayers; 621 this.arrLayers = this.temparrLayers;
604 this.currentLayerNumber = this.arrLayers.length; 622 this.currentLayerNumber = this.arrLayers.length;
623 this._currentDocumentUuid = this.application.ninja.currentDocument.uuid;
605 boolAlreadyInitialized = true; 624 boolAlreadyInitialized = true;
606 625
607 } else if (this.application.ninja.currentDocument.setLevel) { 626 } else if (this.application.ninja.currentDocument.setLevel) {
608 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); 627 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick');
609 // 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.
610 // 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;
611 var parentNode = this.application.ninja.currentSelectedContainer, 631 var parentNode = this.application.ninja.currentSelectedContainer,
612 storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 632 storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
613 this.temparrLayers = []; 633 this.temparrLayers = [];
@@ -643,6 +663,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
643 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 663 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
644 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; 664 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected;
645 this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; 665 this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected;
666 this._currentDocumentUuid = this.application.ninja.currentDocument.uuid;
646 667
647 668
648 //debugger; 669 //debugger;
@@ -703,12 +724,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
703 724
704 handleDocumentChange:{ 725 handleDocumentChange:{
705 value:function () { 726 value:function () {
727 // console.log("TimelinePanel.handleDocumentChange");
728
706 if (this.application.ninja.currentDocument == null) { 729 if (this.application.ninja.currentDocument == null) {
707 // On app initialization, the binding is triggered before 730 // On app initialization, the binding is triggered before
708 // 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.
709 return; 732 return;
710 } 733 }
711 // 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
712 this._boolCacheArrays = false; 742 this._boolCacheArrays = false;
713 this.clearTimelinePanel(); 743 this.clearTimelinePanel();
714 this._boolCacheArrays = true; 744 this._boolCacheArrays = true;
@@ -792,15 +822,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
792 arrLayersLength = this.arrLayers.length, 822 arrLayersLength = this.arrLayers.length,
793 intNumSelected = this.application.ninja.selectedElements.length, 823 intNumSelected = this.application.ninja.selectedElements.length,
794 checkIndex = 0; 824 checkIndex = 0;
795 825
796 this.deselectTweens(); 826 //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected)
797 //console.log("TimelinePanel.handleSelectionChange") 827
798 if (intNumSelected === 0) { 828 if (intNumSelected === 0) {
799 this.selectLayers([]); 829 if (this._ignoreSelectionChanges !== true) {
830 this.selectLayers([]);
831 } else {
832 this._ignoreSelectionChanges = false;
833 }
834
800 this.currentLayerSelected = false; 835 this.currentLayerSelected = false;
801 this.currentLayersSelected = false; 836 this.currentLayersSelected = false;
802 } 837 }
803 838
804 if (intNumSelected === 1) { 839 if (intNumSelected === 1) {
805 this.currentLayersSelected = false; 840 this.currentLayersSelected = false;
806 if (this.application.ninja.selectedElements[0]) { 841 if (this.application.ninja.selectedElements[0]) {
@@ -851,7 +886,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
851 886
852 //console.log(arrSelectedIndexes); 887 //console.log(arrSelectedIndexes);
853 888
854 889
855 if (this.selectedKeyframes) { 890 if (this.selectedKeyframes) {
856 this.deselectTweens(); 891 this.deselectTweens();
857 } 892 }
@@ -860,8 +895,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
860 this.arrLayers[i].layerData.isSelected = false; 895 this.arrLayers[i].layerData.isSelected = false;
861 this.triggerLayerBinding(i); 896 this.triggerLayerBinding(i);
862 } 897 }
863 898
864 this.currentLayersSelected = false; 899 if (this.currentLayersSelected !== false) {
900 this.currentLayersSelected = false;
901 }
865 if (arrSelectedIndexesLength > 0) { 902 if (arrSelectedIndexesLength > 0) {
866 this.currentLayersSelected = []; 903 this.currentLayersSelected = [];
867 } 904 }
@@ -897,15 +934,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
897 } 934 }
898 }, 935 },
899 936
900
901
902
903
904
905
906
907
908
909 deselectTweens:{ 937 deselectTweens:{
910 value:function () { 938 value:function () {
911 for (var i = 0; i < this.selectedTweens.length; i++) { 939 for (var i = 0; i < this.selectedTweens.length; i++) {
@@ -1032,7 +1060,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1032 1060
1033 this._openDoc = false;