diff options
author | Jon Reid | 2012-04-19 14:26:57 -0700 |
---|---|---|
committer | Jon Reid | 2012-04-19 14:26:57 -0700 |
commit | fc22cd3b5c65dc6f137fbb59443e2061cbbcac26 (patch) | |
tree | 92a071647b347ef4fa02365675d2364c2b9df420 /js | |
parent | 3cc269d008ed9d95ae34adb6db34e6a0c2b272c0 (diff) | |
download | ninja-fc22cd3b5c65dc6f137fbb59443e2061cbbcac26.tar.gz |
Timeline: Bug fix: Maintain selection between document switching.
Diffstat (limited to 'js')
-rw-r--r-- | js/panels/Timeline/Layer.reel/Layer.js | 48 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 15 |
2 files changed, 28 insertions, 35 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 36c77018..5b1ce594 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js | |||
@@ -113,7 +113,18 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
113 | this.layerData.layerTag = newVal; | 113 | this.layerData.layerTag = newVal; |
114 | } | 114 | } |
115 | }, | 115 | }, |
116 | 116 | _docUUID : { | |
117 | value: null | ||
118 | }, | ||
119 | docUUID : { | ||
120 | serializable: true, | ||
121 | get: function() { | ||
122 | return this._docUUID; | ||
123 | }, | ||
124 | set: function(newVal) { | ||
125 | this._docUUID = newVal; | ||
126 | } | ||
127 | }, | ||
117 | /* Position and Transform hottext values */ | 128 | /* Position and Transform hottext values */ |
118 | _dtextPositionX : { | 129 | _dtextPositionX : { |
119 | value:null, | 130 | value:null, |
@@ -555,10 +566,15 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
555 | }, | 566 | }, |
556 | didDraw: { | 567 | didDraw: { |
557 | value: function() { | 568 | value: function() { |
558 | if ((this.isSelected === true) && (this._isFirstDraw === true)) { | 569 | if (this._isFirstDraw === true) { |
559 | // Once we're done drawing the first time we need to tell the TimelinePanel if | 570 | if (this.isSelected === true) { |
560 | // this layer is supposed to be selected. | 571 | if (this.application.ninja.currentDocument._uuid === this._docUUID) { |
561 | this.parentComponent.parentComponent.selectedLayerID = this.layerID; | 572 | // Once we're done drawing the first time we need to tell the TimelinePanel if |
573 | // this layer is supposed to be selected. | ||
574 | //console.log('layerName ' + this.layerName); | ||
575 | this.parentComponent.parentComponent.selectedLayerID = this.layerID; | ||
576 | } | ||
577 | } | ||
562 | this._isFirstDraw = false; | 578 | this._isFirstDraw = false; |
563 | } | 579 | } |
564 | } | 580 | } |
@@ -567,36 +583,16 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
567 | 583 | ||
568 | /* Begin: Controllers */ | 584 | /* Begin: Controllers */ |
569 | 585 | ||
570 | // Initialize a just-created layer with some basic defaults and needed selectors. | 586 | // Initialize a just-created layer |
571 | init: { | 587 | init: { |
572 | value: function() { | 588 | value: function() { |
573 | // Default some vars | ||
574 | //this.arrLayerStyles = []; | ||
575 | |||
576 | // Get some selectors. | 589 | // Get some selectors. |
577 | this.label = this.element.querySelector(".label-layer"); | 590 | this.label = this.element.querySelector(".label-layer"); |
578 | this.titleSelector = this.label.querySelector(".collapsible-label"); | 591 | this.titleSelector = this.label.querySelector(".collapsible-label"); |
579 | this.buttonAddStyle = this.element.querySelector(".button-add"); | 592 | this.buttonAddStyle = this.element.querySelector(".button-add"); |
580 | this.buttonDeleteStyle = this.element.querySelector(".button-delete"); | 593 | this.buttonDeleteStyle = this.element.querySelector(".button-delete"); |
581 | |||
582 | |||
583 | |||
584 | } | 594 | } |
585 | }, | 595 | }, |
586 | selectLayer:{ | ||
587 | value:function(){ | ||
588 | // this.mainCollapser.header.classList.add("layerSelected"); | ||
589 | this.element.classList.add("layerSelected"); | ||
590 | this.isSelected = true; | ||
591 | } | ||
592 | }, | ||
593 | deselectLayer:{ | ||
594 | value:function(){ | ||
595 | // this.mainCollapser.header.classList.remove("layerSelected"); | ||
596 | this.element.classList.remove("layerSelected"); | ||
597 | this.isSelected = false; | ||
598 | } | ||
599 | }, | ||
600 | addStyle : { | 596 | addStyle : { |
601 | value: function() { | 597 | value: function() { |
602 | // Add a new style rule. It should be added above the currently selected rule, | 598 | // Add a new style rule. It should be added above the currently selected rule, |
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 33b99760..eeb74625 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -112,7 +112,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
112 | var selectIndex = this.getLayerIndexByID(newVal); | 112 | var selectIndex = this.getLayerIndexByID(newVal); |
113 | this._selectedLayerID = newVal; | 113 | this._selectedLayerID = newVal; |
114 | this._captureSelection = true; | 114 | this._captureSelection = true; |
115 | this.selectLayer(selectIndex); | 115 | //console.log(selectIndex); |
116 | //debugger; | ||
117 | this.selectLayer(selectIndex, true); | ||
116 | } | 118 | } |
117 | } | 119 | } |
118 | }, | 120 | }, |
@@ -410,6 +412,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
410 | returnObj.layerData.isTrackAnimated = false; | 412 | returnObj.layerData.isTrackAnimated = false; |
411 | returnObj.parentElementUUID = null; | 413 | returnObj.parentElementUUID = null; |
412 | returnObj.parentElement = null; | 414 | returnObj.parentElement = null; |
415 | returnObj.docUUID = this.application.ninja.currentDocument._uuid; | ||
413 | 416 | ||
414 | return returnObj; | 417 | return returnObj; |
415 | } | 418 | } |
@@ -536,14 +539,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
536 | // Initialize BreadCrumb | 539 | // Initialize BreadCrumb |
537 | this.application.ninja.breadCrumbClick = false; | 540 | this.application.ninja.breadCrumbClick = false; |
538 | this.enablePanel(false); | 541 | this.enablePanel(false); |
539 | 542 | ||
540 | /* | ||
541 | Object.defineBinding(this, "breadCrumbContainer", { | ||
542 | boundObject:this.application.ninja, | ||
543 | boundObjectPropertyPath:"currentSelectedContainer", | ||
544 | oneway:true | ||
545 | }); | ||
546 | */ | ||
547 | } | 543 | } |
548 | }, | 544 | }, |
549 | 545 | ||
@@ -684,6 +680,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
684 | // Clear the timeline but not the cache | 680 | // Clear the timeline but not the cache |
685 | //console.log('TimelinePanel.handleDocumentChange'); | 681 | //console.log('TimelinePanel.handleDocumentChange'); |
686 | if ((event.type === "closeDocument") && (this.application.ninja.documentController._documents.length > 0)) { | 682 | if ((event.type === "closeDocument") && (this.application.ninja.documentController._documents.length > 0)) { |
683 | // Ignore extra closeDocument event that fires while there are still documents open. | ||
687 | return; | 684 | return; |
688 | } | 685 | } |
689 | this._boolCacheArrays = false; | 686 | this._boolCacheArrays = false; |