aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rwxr-xr-xjs/panels/Splitter.js35
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js65
2 files changed, 80 insertions, 20 deletions
<
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index 98ebb36a..0640abb2 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -55,7 +55,6 @@ exports.Splitter = Montage.create(Component, {
55 }, 55 },
56 set: function(value) { 56 set: function(value) {
57 this._collapsed = value; 57 this._collapsed = value;
58
59 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); 58 this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value});
60 } 59 }
61 }, 60 },
@@ -139,5 +138,39 @@ exports.Splitter = Montage.create(Component, {
139 value: function() { 138 value: function() {
140 this.handleClick(); 139 this.handleClick();
141 } 140 }
141 },
142
143 collapse:{
144 value: function() {
145 if (this.collapsed === false) {
146 if(this.panel.element) {
147 this.panel.element.addEventListener("webkitTransitionEnd", this, false);
148 } else {
149 this.panel.addEventListener("webkitTransitionEnd", this, false);
150 }
151 this._collapsed = true;
152 this.needsDraw = true;
153 }
154 }
155 },
156 restore:{
157 value: function() {
158 //Get splitter initial value from SettingManager
159 var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed;
160 if(storedData && this.element.getAttribute("data-montage-id") !== null) {
161 this._collapsed = storedData.value;
162
163 } else {
164 this._collapsed = false;
165 }
166 if(temp != this._collapsed){
167 if(this.panel.element) {
168 this.panel.element.addEventListener("webkitTransitionEnd", this, false);
169 } else {
170 this.panel.addEventListener("webkitTransitionEnd", this, false);
171 }
172 this.needsDraw = true;
173 }
174 }
142 } 175 }
143}); 176});
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]) {