From fff4cd20a23b95519333daec564f309be7d7d4ec Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 21 Jun 2012 18:01:39 -0700 Subject: Timeline: Bug fix: When creating a new file, Timeline was disabled. (Injection from fix of IKNINJA-1783) --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 48 ++++++++++++---------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 96be66e8..0d0be721 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -117,36 +117,42 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (value === this._currentDocument) { return; } - + this._currentDocument = value; + + var boolDoc = false, + boolView = false; + // Should we enable the panel? + // Only if we have both a document and we're in design view. + if (typeof(value) !== "undefined") { + if (value.currentView === "design") { + // We are in design view. + boolView = true; + } + } if (typeof(this._currentDocument) !== "undefined") { // We have a document, or at least we have initialized the panel. - // What view are we in? - if (typeof(value) !== "undefined") { - if (value.currentView === "design") { - // We are in design view, so enable the panel. - this.enablePanel(true); - } - } + boolDoc = true; } - this._currentDocument = value; - - if(!value) { + if(boolDoc === false) { this._boolCacheArrays = false; this.clearTimelinePanel(); this._boolCacheArrays = true; this.enablePanel(false); - } else if(this._currentDocument.currentView === "design") { - this._boolCacheArrays = false; - this.clearTimelinePanel(); - this._boolCacheArrays = true; - - // Rebind the document events for the new document context - this._bindDocumentEvents(); - - // Initialize the timeline for the document. - this.initTimelineForDocument(); + } else { + if(boolView === true) { + this._boolCacheArrays = false; + this.clearTimelinePanel(); + this._boolCacheArrays = true; + + // Rebind the document events for the new document context + this._bindDocumentEvents(); + + // Initialize the timeline for the document. + this.initTimelineForDocument(); + this.enablePanel(true); + } } } }, -- cgit v1.2.3