aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js91
1 files changed, 28 insertions, 63 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index eeb74625..0b688139 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -26,6 +26,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
26 return this._arrLayers; 26 return this._arrLayers;
27 }, 27 },
28 set:function (newVal) { 28 set:function (newVal) {
29// debugger;
29 this._arrLayers = newVal; 30 this._arrLayers = newVal;
30 this.needsDraw = true; 31 this.needsDraw = true;
31 this.cacheTimeline(); 32 this.cacheTimeline();
@@ -136,16 +137,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
136 } 137 }
137 }, 138 },
138 139
139 tweenarray:{
140 value:[],
141 writable:true
142 },
143
144 tempArray:{
145 value:[],
146 writable:true
147 },
148
149 _masterDuration:{ 140 _masterDuration:{
150 serializable:true, 141 serializable:true,
151 value:0 142 value:0
@@ -205,22 +196,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
205 } 196 }
206 }, 197 },
207 198
208 _breadCrumbContainer:{
209 value:null
210 },
211
212 breadCrumbContainer:{
213 get:function () {
214 return this._breadCrumbContainer;
215 },
216 set:function (value) {
217 if (this._breadCrumbContainer !== value) {
218 this._breadCrumbContainer = value;
219 this.LayerBinding();
220 }
221 }
222 },
223
224 _isLayer:{ 199 _isLayer:{
225 value:false 200 value:false
226 }, 201 },
@@ -316,6 +291,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
316 this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false); 291 this.eventManager.addEventListener("onOpenDocument", this.handleDocumentChange.bind(this), false);
317 this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false); 292 this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false);
318 this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false); 293 this.eventManager.addEventListener("switchDocument", this.handleDocumentChange.bind(this), false);
294 this.eventManager.addEventListener("breadCrumbBinding",this,false);
319 295
320 // Bind drag and drop event handlers 296 // Bind drag and drop event handlers
321 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); 297 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false);
@@ -329,6 +305,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
329 this.checkable_absolute.addEventListener("click", this.handleAbsoluteClick.bind(this), false); 305 this.checkable_absolute.addEventListener("click", this.handleAbsoluteClick.bind(this), false);
330 this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); 306 this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false);
331 document.addEventListener("click", this.handleDocumentClick.bind(this), false); 307 document.addEventListener("click", this.handleDocumentClick.bind(this), false);
308
332 } 309 }
333 }, 310 },
334 311
@@ -425,9 +402,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
425 if (this._boolCacheArrays) { 402 if (this._boolCacheArrays) {
426 // ... but only if we're supposed to. 403 // ... but only if we're supposed to.
427 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 404 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
428 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentSelectedContainer; 405 this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer;
429 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; 406 this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber;
430 this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; 407 this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected;
431 } 408 }
432 } 409 }
433 }, 410 },
@@ -505,19 +482,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
505 for (i = 0; i < arrEventsLength; i++) { 482 for (i = 0; i < arrEventsLength; i++) {
506 this.eventManager.removeEventListener(arrEvents[i], this, false); 483 this.eventManager.removeEventListener(arrEvents[i], this, false);
507 } 484 }
508 if (this._bindingDescriptors !== null) { 485
509 //console.log('Unbinding breadcrumbcontainer')
510 Object.deleteBinding(this, "breadCrumbContainer");
511 }
512 } else { 486 } else {
513 for (i = 0; i < arrEventsLength; i++) { 487 for (i = 0; i < arrEventsLength; i++) {
514 this.eventManager.addEventListener(arrEvents[i], this, false); 488 this.eventManager.addEventListener(arrEvents[i], this, false);
515 } 489 }
516 Object.defineBinding(this, "breadCrumbContainer", { 490
517 boundObject:this.application.ninja,
518 boundObjectPropertyPath:"currentSelectedContainer",
519 oneway:true
520 });
521 } 491 }
522 } 492 }
523 }, 493 },
@@ -547,13 +517,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
547 // Called when a document is opened (new or existing), or when documents are switched. 517 // Called when a document is opened (new or existing), or when documents are switched.
548 initTimelineForDocument:{ 518 initTimelineForDocument:{
549 value:function () { 519 value:function () {
520 if(this.application.ninja.currentDocument.breadCrumbClick === undefined){
521 this.application.ninja.currentDocument.breadCrumbClick = false;
522 }
550 var myIndex, 523 var myIndex,
551 boolAlreadyInitialized = false; 524 boolAlreadyInitialized = false;
552 this.drawTimeMarkers(); 525 this.drawTimeMarkers();
553 // Document switching 526 // Document switching
554 // Check to see if we have saved timeline information in the currentDocument. 527 // Check to see if we have saved timeline information in the currentDocument.
555 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") && 528 if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") &&
556 (!this.application.ninja.breadCrumbClick)) { 529 (!this.application.ninja.currentDocument.breadCrumbClick)) {
557 //console.log('TimelinePanel.initTimelineForDocument: new Document'); 530 //console.log('TimelinePanel.initTimelineForDocument: new Document');
558 // No, we have no information stored. 531 // No, we have no information stored.
559 // This could mean we are creating a new file, OR are opening an existing file. 532 // This could mean we are creating a new file, OR are opening an existing file.
@@ -580,7 +553,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
580 this.currentLayerNumber = this.arrLayers.length; 553 this.currentLayerNumber = this.arrLayers.length;
581 boolAlreadyInitialized = true; 554 boolAlreadyInitialized = true;
582 555
583 } else if (this.application.ninja.breadCrumbClick) { 556 } else if (this.application.ninja.currentDocument.breadCrumbClick) {
584 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); 557 //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick');
585 // Information stored, but we're moving up or down in the breadcrumb. 558 // Information stored, but we're moving up or down in the breadcrumb.
586 // Get the current selection and restore timeline info for its children. 559 // Get the current selection and restore timeline info for its children.
@@ -590,16 +563,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
590 563
591 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) { 564 for (myIndex = 0; parentNode.children[myIndex]; myIndex++) {
592 this._openDoc = true; 565 this._openDoc = true;
566 this.application.ninja.currentDocument.breadCrumbClick = false;
593 this.restoreLayer(parentNode.children[myIndex]); 567 this.restoreLayer(parentNode.children[myIndex]);
568
594 } 569 }
595 570 this.application.ninja.currentDocument.breadCrumbClick = false;
596 // Draw the repetition. 571 // Draw the repetition.
597 this.arrLayers = this.temparrLayers; 572 this.arrLayers = this.temparrLayers;
598 this.currentLayerNumber = storedCurrentLayerNumber; 573 this.currentLayerNumber = storedCurrentLayerNumber;
599 this.currentLayerSelected = this.application.ninja.currentSelectedContainer;
600 // this.application.ninja.breadCrumbClick = false;
601 boolAlreadyInitialized = true; 574 boolAlreadyInitialized = true;
602 575
603 } else { 576 } else {
604 //console.log('TimelinePanel.initTimelineForDocument: else fallback'); 577 //console.log('TimelinePanel.initTimelineForDocument: else fallback');
605 // we do have information stored. Use it. 578 // we do have information stored. Use it.
@@ -616,7 +589,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
616 this.application.ninja.currentDocument.tlArrLayers[i].layerData._isFirstDraw = false; 589 this.application.ninja.currentDocument.tlArrLayers[i].layerData._isFirstDraw = false;
617 } 590 }
618 } 591 }
619
620 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; 592 this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
621 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; 593 this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber;
622 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; 594 this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected;
@@ -701,6 +673,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
701 } 673 }
702 }, 674 },
703 675
676 handleBreadCrumbBinding:{
677 value:function(event){
678
679 if((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined"))
680 return;
681 if(this.application.ninja.currentDocument.breadCrumbClick){
682 this.handleDocumentChange(event);