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.js101
1 files changed, 51 insertions, 50 deletions
diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js
index ca610907..e3a0c542 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>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License.
5 4
6Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 6modification, 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
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -29,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 30</copyright> */
30 31
31var Montage = require("montage/core/core").Montage, 32var Montage = require("montage/core/core").Montage,
32 Component = require("montage/ui/component").Component; 33 Component = require("montage/ui/component").Component;
33 34
34var Span = exports.Span = Montage.create(Component, { 35var Span = exports.Span = Montage.create(Component, {
35 36
@@ -51,39 +52,39 @@ 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 },
58 isHighlighted: { 59 isHighlighted: {
59 get: function() { 60 get: function() {
60 return this._isHighlighted; 61 return this._isHighlighted;
61 }, 62 },
62 set: function(newVal) { 63 set: function(newVal) {
63 if (newVal !== this._isHighlighted) { 64 if (newVal !== this._isHighlighted) {
64 this._isHighlighted = newVal; 65 this._isHighlighted = newVal;
65 this.needsDraw = true; 66 this.needsDraw = true;
66 } 67 }
67 } 68 }
68 }, 69 },
69 70
70 _areChoicesVisible: { 71 _areChoicesVisible: {
71 value: false 72 value: false
72 }, 73 },
73 areChoicesVisible: { 74 areChoicesVisible: {
74 get: function() { 75 get: function() {
75 return this._areChoicesVisible; 76 return this._areChoicesVisible;
76 }, 77 },
77 set: function(newVal) { 78 set: function(newVal) {
78 if (newVal !== this._areChoicesVisible) { 79 if (newVal !== this._areChoicesVisible) {
79 this._areChoicesVisible = newVal; 80 this._areChoicesVisible = newVal;
80 this.needsDraw = true; 81 this.needsDraw = true;
81 } 82 }
82 } 83 }
83 }, 84 },
84 85
85 _easing: { 86 _easing: {
86 value: "none" 87 value: "none"
87 }, 88 },
88 easing: { 89 easing: {
89 get: function() { 90 get: function() {
@@ -133,21 +134,21 @@ var Span = exports.Span = Montage.create(Component, {
133 this.easing_choice.style.width = choiceWidth + "px"; 134 this.easing_choice.style.width = choiceWidth + "px";
134 this.easing_choice.style.overflow = "hidden"; 135 this.easing_choice.style.overflow = "hidden";
135 } 136 }
136 if (this.spanWidth > 70) { 137 if (this.spanWidth > 70) {
137 this.container_easing.setAttribute("style", ""); 138 this.container_easing.setAttribute("style", "");
138 this.easing_choice.setAttribute("style", ""); 139 this.easing_choice.setAttribute("style", "");
139 } 140 }
140 141
141 if (this.isHighlighted === true) { 142 if (this.isHighlighted === true) {
142 this.element.classList.add("spanHighlight"); 143 this.element.classList.add("spanHighlight");
143 } else { 144 } else {
144 this.element.classList.remove("spanHighlight"); 145 this.element.classList.remove("spanHighlight");
145 } 146 }
146 147
147 if (this.easing_choice.innerText !== this.easing) { 148 if (this.easing_choice.innerText !== this.easing) {
148 this.easing_choice.innerText = this.easing; 149 this.easing_choice.innerText = this.easing;
149 } 150 }
150 151
151 } 152 }
152 }, 153 },
153 154
@@ -162,12 +163,12 @@ var Span = exports.Span = Montage.create(Component, {
162 this.application.ninja.timeline.easingMenu.anchor = this.easing_choice; 163 this.application.ninja.timeline.easingMenu.anchor = this.easing_choice;
163 this.application.ninja.timeline.easingMenu.currentChoice = event.currentTarget.innerText; 164 this.application.ninja.timeline.easingMenu.currentChoice = event.currentTarget.innerText;
164 165
165 function findPos(obj) { 166 function findPos(obj) {
166 var objReturn = {}; 167 var objReturn = {};
167 objReturn.top = 0; 168 objReturn.top = 0;
168 objReturn.left = 0; 169 objReturn.left = 0;
169 170
170 if (obj.offsetParent) { 171 if (obj.offsetParent) {
171 172
172 do { 173 do {
173 objReturn.left += obj.offsetLeft; 174 objReturn.left += obj.offsetLeft;
@@ -185,8 +186,8 @@ var Span = exports.Span = Montage.create(Component, {
185 } 186 }
186 }, 187 },
187 handleEasingChoicesClick: { 188 handleEasingChoicesClick: {
188 value: function(event) { 189 value: function(event) {
189 event.stopPropagation(); 190 event.stopPropagation();
190 191
191 /* Un-highlight the old choice and highlight the new choice */ 192 /* Un-highlight the old choice and highlight the new choice */
192 this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected"); 193 this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected");