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 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'js/panels/Timeline/Span.reel/Span.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; } } -- cgit v1.2.3