diff options
Diffstat (limited to 'js/panels/Timeline/Span.reel/Span.js')
-rw-r--r-- | js/panels/Timeline/Span.reel/Span.js | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index 0d013fe5..8f2c8e21 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, are permitted provided that the following conditions are met: |
8 | 7 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 8 | * Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 9 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 10 | |
12 | notice, this list of conditions and the following disclaimer in the | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
13 | documentation and/or other materials provided with the distribution. | 12 | this list of conditions and the following disclaimer in the documentation |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 13 | and/or other materials provided with the distribution. |
15 | may be used to endorse or promote products derived from this software | 14 | |
16 | without specific prior written permission. | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
17 | 18 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -51,7 +52,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
51 | this.needsDraw = true; | 52 | this.needsDraw = true; |
52 | } | 53 | } |
53 | }, | 54 | }, |
54 | 55 | ||
55 | _isHighlighted: { | 56 | _isHighlighted: { |
56 | value: false | 57 | value: false |
57 | }, | 58 | }, |
@@ -66,7 +67,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
66 | } | 67 | } |
67 | } | 68 | } |
68 | }, | 69 | }, |
69 | 70 | ||
70 | _areChoicesVisible: { | 71 | _areChoicesVisible: { |
71 | value: false | 72 | value: false |
72 | }, | 73 | }, |
@@ -81,7 +82,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
81 | } | 82 | } |
82 | } | 83 | } |
83 | }, | 84 | }, |
84 | 85 | ||
85 | _easing: { | 86 | _easing: { |
86 | value: "none" | 87 | value: "none" |
87 | }, | 88 | }, |
@@ -102,14 +103,14 @@ var Span = exports.Span = Montage.create(Component, { | |||
102 | } | 103 | } |
103 | } | 104 | } |
104 | }, | 105 | }, |
105 | 106 | ||
106 | // BEGIN: draw cycle | 107 | // BEGIN: draw cycle |
107 | prepareForDraw: { | 108 | prepareForDraw: { |
108 | value: function() { | 109 | value: function() { |
109 | this.init(); | 110 | this.init(); |
110 | } | 111 | } |
111 | }, | 112 | }, |
112 | 113 | ||
113 | draw:{ | 114 | draw:{ |
114 | value: function(){ | 115 | value: function(){ |
115 | this.element.style.width = this.spanWidth + "px"; | 116 | this.element.style.width = this.spanWidth + "px"; |
@@ -132,14 +133,14 @@ var Span = exports.Span = Montage.create(Component, { | |||
132 | this.container_easing.setAttribute("style", ""); | 133 | this.container_easing.setAttribute("style", ""); |
133 | this.easing_choice.setAttribute("style", ""); | 134 | this.easing_choice.setAttribute("style", ""); |
134 | } | 135 | } |
135 | 136 | ||
136 | // Highlight the span? | 137 | // Highlight the span? |
137 | if (this.isHighlighted === true) { | 138 | if (this.isHighlighted === true) { |
138 | this.element.classList.add("spanHighlight"); | 139 | this.element.classList.add("spanHighlight"); |
139 | } else { | 140 | } else { |
140 | this.element.classList.remove("spanHighlight"); | 141 | this.element.classList.remove("spanHighlight"); |
141 | } | 142 | } |
142 | 143 | ||
143 | /* | 144 | /* |
144 | // Hide or show the choices menu? | 145 | // Hide or show the choices menu? |
145 | if (this.areChoicesVisible === true) { | 146 | if (this.areChoicesVisible === true) { |
@@ -148,12 +149,12 @@ var Span = exports.Span = Montage.create(Component, { | |||
148 | this.easing_choices.style.display = "none"; | 149 | this.easing_choices.style.display = "none"; |
149 | } | 150 | } |
150 | */ | 151 | */ |
151 | 152 | ||
152 | // Change easing? | 153 | // Change easing? |
153 | if (this.easing_choice.innerText !== this.easing) { | 154 | if (this.easing_choice.innerText !== this.easing) { |
154 | this.easing_choice.innerText = this.easing; | 155 | this.easing_choice.innerText = this.easing; |
155 | } | 156 | } |
156 | 157 | ||
157 | } | 158 | } |
158 | }, | 159 | }, |
159 | 160 | ||
@@ -165,7 +166,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
165 | 166 | ||
166 | } | 167 | } |
167 | }, | 168 | }, |
168 | 169 | ||
169 | highlightSpan:{ | 170 | highlightSpan:{ |
170 | value: function(){ | 171 | value: function(){ |
171 | // Class add/remove should only be done in draw cycle. | 172 | // Class add/remove should only be done in draw cycle. |
@@ -173,7 +174,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
173 | this.isHighlighted = true; | 174 | this.isHighlighted = true; |
174 | } | 175 | } |
175 | }, | 176 | }, |
176 | 177 | ||
177 | handleEasingChoiceClick: { | 178 | handleEasingChoiceClick: { |
178 | value: function(event) { | 179 | value: function(event) { |
179 | event.stopPropagation(); | 180 | event.stopPropagation(); |
@@ -191,7 +192,7 @@ var Span = exports.Span = Montage.create(Component, { | |||
191 | do { | 192 | do { |
192 | objReturn.left += obj.offsetLeft; | 193 | objReturn.left += obj.offsetLeft; |
193 | objReturn.top += obj.offsetTop; | 194 | objReturn.top += obj.offsetTop; |
194 | 195 | ||
195 | } while (obj = obj.offsetParent); | 196 | } while (obj = obj.offsetParent); |
196 | } | 197 | } |
197 | return objReturn; | 198 | return objReturn; |
@@ -209,21 +210,21 @@ var Span = exports.Span = Montage.create(Component, { | |||
209 | 210 | ||
210 | // Remove the pointer to ourselves | 211 | // Remove the pointer to ourselves |
211 | //this.application.ninja.timeline.currentOpenSpanMenu = false; | 212 | //this.application.ninja.timeline.currentOpenSpanMenu = false; |
212 | 213 | ||
213 | // Un-highlight the old choice and highlight the new choice | 214 | // Un-highlight the old choice and highlight the new choice |
214 | this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected"); | 215 | this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected"); |
215 | event.target.classList.add("easing-selected"); | 216 | event.target.classList.add("easing-selected"); |
216 | 217 | ||
217 | // Set the easing | 218 | // Set the easing |
218 | this.easing = event.target.dataset.ninjaEase; | 219 | this.easing = event.target.dataset.ninjaEase; |
219 | this.parentComponent.easing = this.easing; | 220 | this.parentComponent.easing = this.easing; |
220 | this.parentComponent.tweenData.easing = this.easing; | 221 | this.parentComponent.tweenData.easing = this.easing; |
221 | 222 | ||
222 | // Unbind the event handler | 223 | // Unbind the event handler |
223 | this.application.ninja.timeline.easingMenu.popup.contentEl.removeEventListener("click"); | 224 | this.application.ninja.timeline.easingMenu.popup.contentEl.removeEventListener("click"); |
224 | 225 | ||
225 | // Hide the menu. | 226 | // Hide the menu. |
226 | this.hideEasingMenu(); | 227 | this.hideEasingMenu(); |
227 | } | 228 | } |
228 | }, | 229 | }, |
229 | hideEasingMenu: { | 230 | hideEasingMenu: { |