From 445180591da04f681a22038600e8ab517b82c0ca Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 27 Feb 2012 20:26:49 -0800 Subject: Timeline: try to clean up bogus events manually. --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 8 ++++++++ js/panels/Timeline/Tween.reel/Tween.js | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 0feada6b..912dce83 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -273,6 +273,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.eventManager.removeEventListener("elementDeleted", this, false); this.eventManager.removeEventListener("deleteSelection", this, false); this.eventManager.removeEventListener("selectionChange", this, true); + + // Remove every event listener for every tween in TimelineTrack + for (var i = 0; i < this.arrTracks.length; i++) { + for (var j = 0; j < this.arrTracks[i].tweens.length; j++) { + //this.eventManager.removeEventListener("elementChange", this, false); + this.arrTracks[i].tweens[j].eventManager.removeEventListener("elementChange", this.arrTracks[i].tweens[j], false); + } + } // Reset visual appearance this.application.ninja.timeline.playhead.style.left = "-2px"; diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js index 70b52297..a9ee1fec 100644 --- a/js/panels/Timeline/Tween.reel/Tween.js +++ b/js/panels/Timeline/Tween.reel/Tween.js @@ -138,9 +138,12 @@ var Tween = exports.Tween = Montage.create(Component, { handleElementChange:{ value:function (event) { + if (event.detail.source && event.detail.source !== "tween") { // check for correct element selection - console.log(this.application.ninja.selectedElements[0]._element) + console.log("handleElementChange! " + this.tweenID) + console.log(this.application.ninja.selectedElements[0]._element); + console.log(this.parentComponent.parentComponent.animatedElement); if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) { alert("Wrong element selected for this keyframe track"); } else { @@ -162,6 +165,7 @@ var Tween = exports.Tween = Montage.create(Component, { selectTween:{ value: function(){ // turn on event listener for element change + console.log('adding elementChange event listener for tween ' + this.tweenID) this.eventManager.addEventListener("elementChange", this, false); // select the containing layer -- cgit v1.2.3