diff options
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js')
-rw-r--r-- | js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 156 |
1 files changed, 73 insertions, 83 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 72d26e78..33029e9e 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | |||
@@ -1,41 +1,43 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | All Rights Reserved. |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | BSD License. |
5 | </copyright> */ | 5 | |
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, are permitted provided that the following conditions are met: | ||
8 | |||
9 | - Redistributions of source code must retain the above copyright notice, | ||
10 | this list of conditions and the following disclaimer. | ||
11 | - Redistributions in binary form must reproduce the above copyright | ||
12 | notice, this list of conditions and the following disclaimer in the | ||
13 | documentation and/or other materials provided with the distribution. | ||
14 | - Neither the name of Motorola Mobility nor the names of its contributors | ||
15 | may be used to endorse or promote products derived from this software | ||
16 | without specific prior written permission. | ||
17 | |||
18 | 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 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
28 | POSSIBILITY OF SUCH DAMAGE. | ||
29 | </copyright> */ | ||
6 | 30 | ||
7 | var Montage = require("montage/core/core").Montage; | 31 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | 32 | var Component = require("montage/ui/component").Component; |
9 | 33 | ||
10 | var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | 34 | var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { |
11 | 35 | ||
36 | /* ===- Begin Models ==== */ | ||
12 | hasTemplate:{ | 37 | hasTemplate:{ |
13 | value: true | 38 | value: true |
14 | }, | 39 | }, |
15 | 40 | ||
16 | prepareForDraw:{ | ||
17 | value:function(){ | ||
18 | this.element.addEventListener("click", this, false); | ||
19 | this.trackID = this.parentComponent.parentComponent.parentComponent.parentComponent.trackID; | ||
20 | this.animatedElement = this.parentComponent.parentComponent.parentComponent.parentComponent.animatedElement; | ||
21 | this.ninjaStylesContoller = this.application.ninja.stylesController; | ||
22 | } | ||
23 | }, | ||
24 | |||
25 | draw:{ | ||
26 | value:function(){ | ||
27 | |||
28 | } | ||
29 | }, | ||
30 | |||
31 | didDraw:{ | ||
32 | value:function () { | ||
33 | if(this.currentKeyframeRule){ | ||
34 | this.retrieveStoredStyleTweens(); | ||
35 | } | ||
36 | } | ||
37 | }, | ||
38 | |||
39 | trackEditorProperty:{ | 41 | trackEditorProperty:{ |
40 | value:"" | 42 | value:"" |
41 | }, | 43 | }, |
@@ -51,7 +53,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
51 | _propTweenRepetition:{ | 53 | _propTweenRepetition:{ |
52 | value:null | 54 | value:null |
53 | }, | 55 | }, |
54 | |||
55 | propTweenRepetition:{ | 56 | propTweenRepetition:{ |
56 | get:function () { | 57 | get:function () { |
57 | return this._propTweenRepetition; | 58 | return this._propTweenRepetition; |
@@ -64,7 +65,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
64 | _propTweens:{ | 65 | _propTweens:{ |
65 | value:[] | 66 | value:[] |
66 | }, | 67 | }, |
67 | |||
68 | propTweens:{ | 68 | propTweens:{ |
69 | serializable:true, | 69 | serializable:true, |
70 | get:function () { | 70 | get:function () { |
@@ -78,7 +78,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
78 | _propTrackData:{ | 78 | _propTrackData:{ |
79 | value:false | 79 | value:false |
80 | }, | 80 | }, |
81 | |||
82 | propTrackData:{ | 81 | propTrackData:{ |
83 | serializable:true, | 82 | serializable:true, |
84 | get:function () { | 83 | get:function () { |
@@ -115,7 +114,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
115 | _trackID:{ | 114 | _trackID:{ |
116 | value:null | 115 | value:null |
117 | }, | 116 | }, |
118 | |||
119 | trackID:{ | 117 | trackID:{ |
120 | serializable:true, | 118 | serializable:true, |
121 | get:function () { | 119 | get:function () { |
@@ -131,7 +129,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
131 | _trackType:{ | 129 | _trackType:{ |
132 | value:null | 130 | value:null |
133 | }, | 131 | }, |
134 | |||
135 | trackType:{ | 132 | trackType:{ |
136 | serializable:true, | 133 | serializable:true, |
137 | get:function () { | 134 | get:function () { |
@@ -147,7 +144,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
147 | _styleIndex:{ | 144 | _styleIndex:{ |
148 | value:null | 145 | value:null |
149 | }, | 146 | }, |
150 | |||
151 | styleIndex:{ | 147 | styleIndex:{ |
152 | serializable:true, | 148 | serializable:true, |
153 | get:function () { | 149 | get:function () { |
@@ -174,36 +170,50 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
174 | this.needsDraw = true; | 170 | this.needsDraw = true; |
175 | } | 171 | } |
176 | }, | 172 | }, |
173 | /* ===- End Models ==== */ | ||
174 | |||
175 | /* ===- Begin Draw Cycle ==== */ | ||
176 | prepareForDraw:{ | ||
177 | value:function () { | ||
178 | this.element.addEventListener("click", this, false); | ||
179 | this.trackID = this.parentComponent.parentComponent.parentComponent.parentComponent.trackID; | ||
180 | this.animatedElement = this.parentComponent.parentComponent.parentComponent.parentComponent.animatedElement; | ||
181 | this.ninjaStylesContoller = this.application.ninja.stylesController; | ||
182 | } | ||
183 | }, | ||
184 | |||
185 | didDraw:{ | ||
186 | value:function () { | ||
187 | if (this.currentKeyframeRule) { | ||
188 | this.retrieveStoredStyleTweens(); | ||
189 | } | ||
190 | } | ||
191 | }, | ||
192 | /* ===- End Draw Cycle ==== */ | ||
177 | 193 | ||
194 | /* ===- Begin Event Handlers ==== */ | ||
178 | handleClick:{ | 195 | handleClick:{ |
179 | value:function (ev) { | 196 | value:function (ev) { |
180 | if (ev.shiftKey) { | 197 | if (ev.shiftKey) { |
181 | |||
182 | if (this.trackType == "position") { | 198 | if (this.trackType == "position") { |
183 | this.parentComponent.parentComponent.parentComponent.parentComponent.handleNewTween(ev); | 199 | this.parentComponent.parentComponent.parentComponent.parentComponent.handleNewTween(ev); |
184 | } | 200 | } |
185 | |||
186 | if (this.propTweens.length < 1) { | 201 | if (this.propTweens.length < 1) { |
187 | |||
188 | // check if there is an editor property assigned yet | ||
189 | // get this property track's editor prop name from layer data arrays | ||
190 | var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID), | 202 | var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID), |
191 | currentSelectedStyleIndex = this.getCurrentSelectedStyleIndex(selectIndex); | 203 | currentSelectedStyleIndex = this.getCurrentSelectedStyleIndex(selectIndex); |
192 | 204 | ||
193 | if (this.trackType == "style") { | 205 | if (this.trackType == "style") { |
194 | //console.log("PropertyTrack.handleClick; selectIndex = ", selectIndex, "; styleIndex = ", currentSelectedStyleIndex) | 206 | if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty == null) { |
195 | if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty == null) { | ||
196 | console.log("Please enter a style property for this track before adding keyframes."); | 207 | console.log("Please enter a style property for this track before adding keyframes."); |
197 | return; | 208 | return; |
198 | } else { | 209 | } else { |
199 | this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty; | 210 | this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty; |
200 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); | ||
201 | } | 211 | } |
202 | this.insertPropTween(0); | 212 | this.insertPropTween(0); |
203 | this.addPropAnimationRuleToElement(ev); | 213 | this.addPropAnimationRuleToElement(ev); |
204 | this.updatePropKeyframeRule(); | 214 | this.updatePropKeyframeRule(); |
205 | } else if (this.trackType == "position") { | 215 | } else if (this.trackType == "position") { |
206 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); | 216 | |