aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-06-08 18:08:38 -0700
committerJon Reid2012-06-08 18:08:38 -0700
commit8e98ce012f55576ddb979969a3a1d834301af0c7 (patch)
treedbdd5f7c6508dd1a730c689b980d8d6e74216b4b /js
parent020a8147088f09547b7e84db2ada7c48f25c089f (diff)
downloadninja-8e98ce012f55576ddb979969a3a1d834301af0c7.tar.gz
Timeline: New feature: Only one easing menu can be open at a time.
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/Span.reel/Span.js27
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js17
2 files changed, 41 insertions, 3 deletions
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, {
146 146
147 handleEasingChoiceClick: { 147 handleEasingChoiceClick: {
148 value: function(event) { 148 value: function(event) {
149 event.stopPropagation();
149 this.areChoicesVisible = true; 150 this.areChoicesVisible = true;
151
152 // Possibly another menu is already open. If so, we need to close it.
153 if (this.application.ninja.timeline.currentOpenSpanMenu !== false) {
154 this.application.ninja.timeline.currentOpenSpanMenu.hideEasingMenu();
155 }
156
157 // Now store a pointer to ourselves for possible future use.
158 this.application.ninja.timeline.currentOpenSpanMenu = this;
150 } 159 }
151 }, 160 },
152 handleEasingChoicesClick: { 161 handleEasingChoicesClick: {
153 value: function(event) { 162 value: function(event) {
154 163 event.stopPropagation();
164
165 // Remove the pointer to ourselves
166 this.application.ninja.timeline.currentOpenSpanMenu = false;
167
168 // Un-highlight the old choice and highlight the new choice
155 this.easing_choices.querySelector(".easing-selected").classList.remove("easing-selected"); 169 this.easing_choices.querySelector(".easing-selected").classList.remove("easing-selected");
156 event.target.classList.add("easing-selected"); 170 event.target.classList.add("easing-selected");
171
172 // Set the easing
157 this.easing = event.target.dataset.ninjaEase; 173 this.easing = event.target.dataset.ninjaEase;
158 174
159 // Which element was just 175 // Hide the menu.
176 this.hideEasingMenu();
177 }
178 },
179 hideEasingMenu: {
180 value: function() {
160 this.areChoicesVisible = false; 181 this.areChoicesVisible = false;
161 } 182 }
162 } 183 }
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, {
131 _areTracksScrolling: { 131 _areTracksScrolling: {
132 value: false 132 value: false
133 }, 133 },
134
135 _currentOpenSpanMenu: {
136 value: false
137 },
138 currentOpenSpanMenu: {
139 get: function() {
140 return this._currentOpenSpanMenu;
141 },
142 set: function(newVal) {
143 this._currentOpenSpanMenu = newVal;
144 }
145 },
134 146
135 // Set to false to skip array caching array sets in currentDocument 147 // Set to false to skip array caching array sets in currentDocument
136 _boolCacheArrays:{ 148 _boolCacheArrays:{
@@ -1511,6 +1523,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1511 if (this.tl_configbutton.classList.contains("checked")) { 1523 if (this.tl_configbutton.classList.contains("checked")) {
1512 this.tl_configbutton.classList.remove("checked"); 1524 this.tl_configbutton.classList.remove("checked");
1513 } 1525 }
1526 //
1527 if (this.currentOpenSpanMenu !== false) {
1528 this.currentOpenSpanMenu.hideEasingMenu();
1529 this.currentOpenSpanMenu = false;
1530 }
1514 } 1531 }
1515 }, 1532 },
1516 1533