From 306d72f1f18f4e6ea90146bc6723517fb931ea7d Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 11 Jun 2012 10:14:57 -0700 Subject: Squashed commit of the following: commit 8e98ce012f55576ddb979969a3a1d834301af0c7 Author: Jon Reid Date: Fri Jun 8 18:08:38 2012 -0700 Timeline: New feature: Only one easing menu can be open at a time. Signed-off-by: Jonathan Duran --- js/panels/Timeline/Span.reel/Span.js | 27 +++++++++++++++++++--- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 17 ++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index 1ab3455c..8d4c25ae 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -146,17 +146,38 @@ var Span = exports.Span = Montage.create(Component, { handleEasingChoiceClick: { value: function(event) { + event.stopPropagation(); this.areChoicesVisible = true; + + // Possibly another menu is already open. If so, we need to close it. + if (this.application.ninja.timeline.currentOpenSpanMenu !== false) { + this.application.ninja.timeline.currentOpenSpanMenu.hideEasingMenu(); + } + + // Now store a pointer to ourselves for possible future use. + this.application.ninja.timeline.currentOpenSpanMenu = this; } }, handleEasingChoicesClick: { value: function(event) { - + event.stopPropagation(); + + // Remove the pointer to ourselves + this.application.ninja.timeline.currentOpenSpanMenu = false; + + // Un-highlight the old choice and highlight the new choice this.easing_choices.querySelector(".easing-selected").classList.remove("easing-selected"); event.target.classList.add("easing-selected"); + + // Set the easing this.easing = event.target.dataset.ninjaEase; - - // Which element was just + + // Hide the menu. + this.hideEasingMenu(); + } + }, + hideEasingMenu: { + value: function() { this.areChoicesVisible = false; } } diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index a902d282..8276f878 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -131,6 +131,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { _areTracksScrolling: { value: false }, + + _currentOpenSpanMenu: { + value: false + }, + currentOpenSpanMenu: { + get: function() { + return this._currentOpenSpanMenu; + }, + set: function(newVal) { + this._currentOpenSpanMenu = newVal; + } + }, // Set to false to skip array caching array sets in currentDocument _boolCacheArrays:{ @@ -1511,6 +1523,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (this.tl_configbutton.classList.contains("checked")) { this.tl_configbutton.classList.remove("checked"); } + // + if (this.currentOpenSpanMenu !== false) { + this.currentOpenSpanMenu.hideEasingMenu(); + this.currentOpenSpanMenu = false; + } } }, -- cgit v1.2.3