aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Span.reel/Span.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/Span.reel/Span.js')
-rw-r--r--js/panels/Timeline/Span.reel/Span.js37
1 files changed, 22 insertions, 15 deletions
diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js
index 8d4c25ae..44316469 100644
--- a/js/panels/Timeline/Span.reel/Span.js
+++ b/js/panels/Timeline/Span.reel/Span.js
@@ -4,8 +4,8 @@
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ 5 </copyright> */
6 6
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage,
8var Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10var Span = exports.Span = Montage.create(Component, { 10var Span = exports.Span = Montage.create(Component, {
11 11
@@ -112,12 +112,14 @@ var Span = exports.Span = Montage.create(Component, {
112 this.element.classList.remove("spanHighlight"); 112 this.element.classList.remove("spanHighlight");
113 } 113 }
114 114
115 /*
115 // Hide or show the choices menu? 116 // Hide or show the choices menu?
116 if (this.areChoicesVisible === true) { 117 if (this.areChoicesVisible === true) {
117 this.easing_choices.style.display = "block"; 118 this.easing_choices.style.display = "block";
118 } else { 119 } else {
119 this.easing_choices.style.display = "none"; 120 this.easing_choices.style.display = "none";
120 } 121 }
122 */
121 123
122 // Change easing? 124 // Change easing?
123 if (this.easing_choice.innerText !== this.easing) { 125 if (this.easing_choice.innerText !== this.easing) {
@@ -131,7 +133,7 @@ var Span = exports.Span = Montage.create(Component, {
131 init: { 133 init: {
132 value: function() { 134 value: function() {
133 this.easing_choice.addEventListener("click", this.handleEasingChoiceClick.bind(this), false); 135 this.easing_choice.addEventListener("click", this.handleEasingChoiceClick.bind(this), false);
134 this.easing_choices.addEventListener("click", this.handleEasingChoicesClick.bind(this), false); 136 //this.easing_choices.addEventListener("click", this.handleEasingChoicesClick.bind(this), false);
135 137
136 } 138 }
137 }, 139 },
@@ -147,38 +149,43 @@ var Span = exports.Span = Montage.create(Component, {
147 handleEasingChoiceClick: { 149 handleEasingChoiceClick: {
148 value: function(event) { 150 value: function(event) {
149 event.stopPropagation(); 151 event.stopPropagation();
150 this.areChoicesVisible = true; 152 //this.areChoicesVisible = true;
151 153 this.application.ninja.timeline.easingMenu.anchor = this.easing_choice;
152 // Possibly another menu is already open. If so, we need to close it. 154 this.application.ninja.timeline.easingMenu.currentChoice = event.currentTarget.innerText;
153 if (this.application.ninja.timeline.currentOpenSpanMenu !== false) { 155 console.log(event);
154 this.application.ninja.timeline.currentOpenSpanMenu.hideEasingMenu(); 156 this.application.ninja.timeline.easingMenu.top = 100;
155 } 157 this.application.ninja.timeline.easingMenu.left = 100;
156 158 this.application.ninja.timeline.easingMenu.show();
157 // Now store a pointer to ourselves for possible future use. 159 this.application.ninja.timeline.easingMenu.callingComponent = this;
158 this.application.ninja.timeline.currentOpenSpanMenu = this;
159 } 160 }
160 }, 161 },
161 handleEasingChoicesClick: { 162 handleEasingChoicesClick: {
162 value: function(event) { 163 value: function(event) {
163 event.stopPropagation(); 164 event.stopPropagation();
165
166 console.log("span.handleEasingChoicesClick")
164 167
165 // Remove the pointer to ourselves 168 // Remove the pointer to ourselves
166 this.application.ninja.timeline.currentOpenSpanMenu = false; 169 //this.application.ninja.timeline.currentOpenSpanMenu = false;
167 170
168 // Un-highlight the old choice and highlight the new choice 171 // Un-highlight the old choice and highlight the new choice
169 this.easing_choices.querySelector(".easing-selected").classList.remove("easing-selected"); 172 this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected");
170 event.target.classList.add("easing-selected"); 173 event.target.classList.add("easing-selected");
171 174
172 // Set the easing 175 // Set the easing
173 this.easing = event.target.dataset.ninjaEase; 176 this.easing = event.target.dataset.ninjaEase;
174 177
178 // Unbind the event handler
179 this.application.ninja.timeline.easingMenu.popup.contentEl.removeEventListener("click");
180
175 // Hide the menu. 181 // Hide the menu.
176 this.hideEasingMenu(); 182 this.hideEasingMenu();
177 } 183 }
178 }, 184 },
179 hideEasingMenu: { 185 hideEasingMenu: {
180 value: function() { 186 value: function() {
181 this.areChoicesVisible = false; 187 //this.areChoicesVisible = false;
188 this.application.ninja.timeline.easingMenu.hide();
182 } 189 }
183 } 190 }
184}); 191});