From 92cca9bf067d048c57aaab85479d36cb902c96c2 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 15 Jun 2012 14:31:48 -0700 Subject: Timeline: Bug fix: Correctly maintain expand/collapse state of layers and subproperties across document switching. --- js/panels/Timeline/Span.reel/Span.js | 3 +++ js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 9 ++++----- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index 5b0f3f94..59cd13ed 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -67,6 +67,9 @@ var Span = exports.Span = Montage.create(Component, { }, set: function(newVal) { if (newVal !== this._easing) { + if (typeof(newVal) === "undefined") { + newVal = "ease-in"; + } this._easing = newVal; this.parentComponent.setKeyframeEase(newVal); this.needsDraw = true; diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index bb3ff170..3d109bc1 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -933,12 +933,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // We're reading from the cache, not writing to it. this._boolCacheArrays = false; + + // We are about to redraw the layers and tracks for the first time, so they need to go through their + // respective firstDraw routines. for (i = 0; i < tlArrLayersLength; i++) { - if (this.application.ninja.currentDocument.tlArrLayers[i].layerData.isSelected === true) { - this.application.ninja.currentDocument.tlArrLayers[i].layerData._isFirstDraw = true; - } else { - this.application.ninja.currentDocument.tlArrLayers[i].layerData._isFirstDraw = false; - } + this.application.ninja.currentDocument.tlArrLayers[i].layerData._isFirstDraw = true; } this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; this.currentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 9276a7df..6e09bb64 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -41,6 +41,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this._tween = newVal; } }, + + _isFirstDraw: { + value: true + }, _isVisible:{ value: true -- cgit v1.2.3 From 1f8cb3a25745e5eb07bffccb4f5d5958e595e740 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 15 Jun 2012 17:32:28 -0700 Subject: Timeline: Bug fix: Document switching no longer causes multiple styles to be added. --- js/panels/Timeline/Layer.reel/Layer.js | 21 ++++++++++++++++++--- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 14 ++++++++++++++ .../Timeline/TimelineTrack.reel/TimelineTrack.js | 3 ++- 3 files changed, 34 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 4941ff79..0abd97be 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -710,7 +710,15 @@ var Layer = exports.Layer = Montage.create(Component, { // Set up the event info and dispatch the event this.styleCounter += 1; // newEvent.styleSelection = mySelection; - defaultEventManager.dispatchEvent(newEvent); + //defaultEventManager.dispatchEvent(newEvent); + + // Dispatch the event to the TimelineTrack component associated with this Layer. + var myIndex = this.application.ninja.timeline.getActiveLayerIndex(), + arrTracks = document.querySelectorAll('[data-montage-id="track"]'); + + if (myIndex !== false) { + arrTracks[myIndex].dispatchEvent(newEvent); + } } }, @@ -728,8 +736,15 @@ var Layer = exports.Layer = Montage.create(Component, { newEvent.layerID = this.layerID; newEvent.styleID = this.selectedStyleIndex; newEvent.selectedStyleIndex = this.selectedStyleIndex; - defaultEventManager.dispatchEvent(newEvent); - + + // Dispatch the event to the TimelineTrack component associated with this Layer. + var myIndex = this.application.ninja.timeline.getActiveLayerIndex(), + arrTracks = document.querySelectorAll('[data-montage-id="track"]'); + + if (myIndex !== false) { + arrTracks[myIndex].dispatchEvent(newEvent); + } + // Delete the style from the view this.arrLayerStyles.splice(this.selectedStyleIndex, 1); diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 3d109bc1..27b3537c 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -1934,6 +1934,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { return false; } }, + + getActiveLayerIndex: { + value: function() { + var i = 0, + returnVal = false, + arrLayersLength = this.arrLayers.length; + for (i = 0; i < arrLayersLength; i++) { + if (this.arrLayers[i].isSelected === true) { + returnVal = i; + } + } + return returnVal; + } + }, /* === END: Controllers === */ /* === BEGIN: Logging routines === */ diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 6e09bb64..3db57a3a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -974,7 +974,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { value:function () { this.createPositionTracks(); // Register event handler for layer events. - defaultEventManager.addEventListener("layerEvent", this, false); + //defaultEventManager.addEventListener("layerEvent", this, false); + this.element.addEventListener("layerEvent", this, false); } }, -- cgit v1.2.3