aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Layer.reel/Layer.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/Layer.reel/Layer.js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js627
1 files changed, 627 insertions, 0 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
new file mode 100644
index 00000000..f62c0b90
--- /dev/null
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -0,0 +1,627 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component;
9var Collapser = require("js/panels/Timeline/Collapser").Collapser;
10var Hintable = require("js/components/hintable.reel").Hintable;
11var LayerStyle = require("js/panels/Timeline/Style.reel").LayerStyle;
12var DynamicText = require("montage/ui/dynamic-text.reel").DynamicText;
13var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager;
14var nj = require("js/lib/NJUtils").NJUtils;
15
16var Layer = exports.Layer = Montage.create(Component, {
17
18 hasTemplate:{
19 value: true
20 },
21
22 /* Begin: Models */
23
24 /* Main collapser model: the main collapser for the layer */
25 _mainCollapser : {
26 value: false
27 },
28 mainCollapser: {
29 get: function() {
30 return this._mainCollapser;
31 },
32 set: function(newVal) {
33 this._mainCollapser = newVal;
34 }
35 },
36
37 /* Style models: the array of styles, and the repetition that uses them */
38 _arrLayerStyles : {
39 serializable: true,
40 enumerable: true,
41 serializable: true,
42 value: []
43 },
44 arrLayerStyles : {
45 serializable: true,
46 enumerable: true,
47 serializable: true,
48 get: function() {
49 return this._arrLayerStyles;
50 },
51 set: function(newVal) {
52 this._arrLayerStyles = newVal;
53 }
54 },
55 _styleRepetition : {
56 value: false
57 },
58 styleRepetition : {
59 get: function() {
60 return this._styleRepetition;
61 },
62 set: function(newVal) {
63 this._styleRepetition = newVal;
64 }
65 },
66 _styleCounter : {
67 value: 0
68 },
69
70 /* Layer models: the name, ID, and selected and animation booleans for the layer */
71 _layerName:{
72 serializable: true,
73 value:null,
74 writable:true,
75 enumerable:true
76 },
77
78 layerName:{
79 serializable: true,
80 get:function(){
81 return this._layerName;
82 },
83 set:function(newVal){
84 if (newVal !== this._layerName) {
85 this._layerEditable.value = newVal;
86 this._layerName = newVal;
87 this._layerEditable.needsDraw = true;
88 this.needsDraw = true;
89 }
90
91 }
92 },
93 _layerID:{
94 value:null,
95 writable:true,
96 serializable: true,
97 enumerable:true
98 },
99
100 layerID:{
101 serializable: true,
102 get:function(){
103 return this._layerID;
104 },
105 set:function(value){
106 this._layerID = value;
107 }
108 },
109
110 /* isSelected: whether or not the layer is currently selected. */
111 _isSelected:{
112 value: false,
113 writable: true,
114 serializable: true,
115 enumerable: false
116 },
117
118 isSelected:{
119 get:function(){
120 return this._isSelected;
121 },
122 set:function(value){
123 if (value !== this._isSelected) {
124 // Only concerned about different values
125 if (value === false) {
126 // If changing from false to true, we need to deselect any associated styles
127 this.selectStyle(false);
128 }
129 this._isSelected = value;
130 this.needsDraw = true;
131 }
132
133 }
134 },
135
136 /* isActive: Whether or not the user is actively clicking within the layer; used to communicate state with
137 * TimelinePanel.
138 */
139 _isActive: {
140 value: false
141 },
142 isActive: {
143 get: function() {
144 return this._isActive;
145 },
146 set: function(newVal) {
147 this._isActive = newVal;
148 }
149 },
150
151
152 _isAnimated:{
153 value: false,
154 writable: true,
155 enumerable: false
156 },
157
158 isAnimated:{
159 get:function(){
160 return this._isAnimated;
161 },
162 set:function(value){
163 this._isAnimated = value;
164 }
165 },
166 _justAdded: {
167 value: false
168 },
169 _layerEditable : {
170 value: false
171 },
172
173 // Are the various collapsers collapsed or not
174 _isMainCollapsed : {
175 value: ""
176 },
177 isMainCollapsed : {
178 get: function() {
179 return this._isMainCollapsed;
180 },
181 set: function(newVal) {
182 if (newVal !== this._isMainCollapsed) {
183 this._isMainCollapsed = newVal;
184 this.needsDraw = true;
185 }
186 }
187 },
188
189 _isTransformCollapsed : {
190 value: true
191 },
192 isTransformCollapsed : {
193 get: function() {
194 return this._isTransformCollapsed;
195 },
196 set: function(newVal) {
197 if (newVal !== this._isTransformCollapsed) {
198 this._isTransformCollapsed = newVal;
199 this.needsDraw = true;
200 }
201 }
202 },
203
204 _isPositionCollapsed : {
205 value: true
206 },
207 isPositionCollapsed : {
208 get: function() {
209 return this._isPositionCollapsed;
210 },
211 set: function(newVal) {
212 if (newVal !== this._isPositionCollapsed) {
213 this._isPositionCollapsed = newVal;
214 this.needsDraw = true;
215 }
216 }
217 },
218
219 _isStyleCollapsed : {
220 value: true
221 },
222 isStyleCollapsed : {
223 get: function() {
224 return this._isStyleCollapsed;
225 },
226 set: function(newVal) {
227 if (newVal !== this._isStyleCollapsed) {
228 this._isStyleCollapsed = newVal;
229 this.needsDraw = true;
230 }
231 }
232 },
233
234
235 /* END: Models */
236
237 /* Begin: Draw cycle */
238 prepareForDraw: {
239 value: function() {