From 8964e070fa760d23c2de272ca36b8d9beba6007d Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 4 May 2012 12:55:23 -0700 Subject: Timeline: More fixes to selection changing and document switching. --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 45 +++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'js/panels/Timeline') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 48818e44..cb4fbf07 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -329,6 +329,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { useAbsolutePosition:{ value:true }, + _currentDocumentUuid: { + value: false + }, + _ignoreSelectionChanges: { + value: false + }, /* === END: Models === */ /* === BEGIN: Draw cycle === */ prepareForDraw:{ @@ -584,6 +590,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.drawTimeMarkers(); // Document switching // Check to see if we have saved timeline information in the currentDocument. + //console.log("TimelinePanel.initTimelineForDocument"); + if ((typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined")) { //console.log('TimelinePanel.initTimelineForDocument: new Document'); // No, we have no information stored. @@ -609,12 +617,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Draw the repetition. this.arrLayers = this.temparrLayers; this.currentLayerNumber = this.arrLayers.length; + this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; boolAlreadyInitialized = true; } else if (this.application.ninja.currentDocument.setLevel) { //console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); // Information stored, but we're moving up or down in the breadcrumb. // Get the current selection and restore timeline info for its children. + //debugger; var parentNode = this.application.ninja.currentSelectedContainer, storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; this.temparrLayers = []; @@ -650,6 +660,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; this.currentLayerSelected = this.application.ninja.currentDocument.tlCurrentLayerSelected; this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; + this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; //debugger; @@ -710,12 +721,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleDocumentChange:{ value:function () { + // console.log("TimelinePanel.handleDocumentChange"); + if (this.application.ninja.currentDocument == null) { // On app initialization, the binding is triggered before // there is a currentDocument. We don't do anything at that time. return; } - // this.application.ninja.currentDocument.setLevel = true; + + // Is this the same document? + if (this._currentDocumentUuid === this.application.ninja.currentDocument.uuid) { + // Yes, same document, so we are changing levels. + this.application.ninja.currentDocument.setLevel = true; + this._ignoreSelectionChanges = true; + } + this._boolCacheArrays = false; this.clearTimelinePanel(); this._boolCacheArrays = true; @@ -799,15 +819,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { arrLayersLength = this.arrLayers.length, intNumSelected = this.application.ninja.selectedElements.length, checkIndex = 0; - - this.deselectTweens(); - //console.log("TimelinePanel.handleSelectionChange") + + //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected) + if (intNumSelected === 0) { - this.selectLayers([]); + if (this._ignoreSelectionChanges !== true) { + this.selectLayers([]); + } else { + this._ignoreSelectionChanges = false; + } + this.currentLayerSelected = false; this.currentLayersSelected = false; } - + if (intNumSelected === 1) { this.currentLayersSelected = false; if (this.application.ninja.selectedElements[0]) { @@ -858,7 +883,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { //console.log(arrSelectedIndexes); - + if (this.selectedKeyframes) { this.deselectTweens(); } @@ -867,8 +892,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.arrLayers[i].layerData.isSelected = false; this.triggerLayerBinding(i); } - - this.currentLayersSelected = false; + + if (this.currentLayersSelected !== false) { + this.currentLayersSelected = false; + } if (arrSelectedIndexesLength > 0) { this.currentLayersSelected = []; } -- cgit v1.2.3