aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
diff options
context:
space:
mode:
authorKruti Shah2012-07-09 11:30:37 -0700
committerKruti Shah2012-07-09 11:30:37 -0700
commit35a31845720beb1296dc42a79fa068601dfc52cb (patch)
tree252ba58a3f2bb9600262c48571cc3dabaee36449 /js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
parentb35edd96135bd8c2b500ffee08474bacd17c25ac (diff)
parent39aa69624e1e3b8598b0242ee6ec436862b67280 (diff)
downloadninja-35a31845720beb1296dc42a79fa068601dfc52cb.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js')
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js156
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/> 2Copyright (c) 2012, Motorola Mobility, Inc
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5 </copyright> */ 5
6Redistribution and use in source and binary forms, with or without
7modification, 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
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */
6 30
7var Montage = require("montage/core/core").Montage; 31var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 32var Component = require("montage/ui/component").Component;
9 33
10var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { 34var 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