diff options
Diffstat (limited to 'js/panels/Timeline/Layer.reel/Layer.js')
-rw-r--r-- | js/panels/Timeline/Layer.reel/Layer.js | 779 |
1 files changed, 605 insertions, 174 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index a2d6444d..776d5ec8 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js | |||
@@ -12,6 +12,7 @@ var LayerStyle = require("js/panels/Timeline/Style.reel").LayerStyle; | |||
12 | var DynamicText = require("montage/ui/dynamic-text.reel").DynamicText; | 12 | var DynamicText = require("montage/ui/dynamic-text.reel").DynamicText; |
13 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; | 13 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; |
14 | var nj = require("js/lib/NJUtils").NJUtils; | 14 | var nj = require("js/lib/NJUtils").NJUtils; |
15 | var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
15 | 16 | ||
16 | var Layer = exports.Layer = Montage.create(Component, { | 17 | var Layer = exports.Layer = Montage.create(Component, { |
17 | 18 | ||
@@ -78,6 +79,7 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
78 | value: false | 79 | value: false |
79 | }, | 80 | }, |
80 | styleRepetition : { | 81 | styleRepetition : { |
82 | serializable: true, | ||
81 | get: function() { | 83 | get: function() { |
82 | return this._styleRepetition; | 84 | return this._styleRepetition; |
83 | }, | 85 | }, |
@@ -88,10 +90,39 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
88 | _styleCounter : { | 90 | _styleCounter : { |
89 | value: 0 | 91 | value: 0 |
90 | }, | 92 | }, |
93 | styleCounter:{ | ||
94 | serializable:true, | ||
95 | get:function () { | ||
96 | return this._styleCounter; | ||
97 | }, | ||
98 | set:function (newVal) { | ||
99 | this._styleCounter = newVal; | ||
100 | } | ||
101 | }, | ||
102 | _selectedStyleIndex: { | ||
103 | value: false | ||
104 | }, | ||
105 | selectedStyleIndex: { | ||
106 | get: function() { | ||
107 | return this._selectedStyleIndex; | ||
108 | }, | ||
109 | set: function(newVal) { | ||
110 | if (typeof(newVal) === "undefined") { | ||
111 | return; | ||
112 | } | ||
113 | if (newVal !== this._selectedStyleIndex) { | ||
114 | this._selectedStyleIndex = newVal; | ||
115 | this.layerData.selectedStyleIndex = newVal; | ||
116 | } | ||
117 | } | ||
118 | }, | ||
119 | _storedStyleIndex : { | ||
120 | value: false | ||
121 | }, | ||
91 | 122 | ||
92 | /* Layer models: the name, ID, and selected and animation booleans for the layer */ | 123 | /* Layer models: the name, ID, and selected and animation booleans for the layer */ |
93 | _layerName:{ | 124 | _layerName:{ |
94 | value: "Default Layer Name" | 125 | value: "" |
95 | }, | 126 | }, |
96 | 127 | ||
97 | layerName:{ | 128 | layerName:{ |
@@ -100,13 +131,22 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
100 | return this._layerName; | 131 | return this._layerName; |
101 | }, | 132 | }, |
102 | set:function(newVal){ | 133 | set:function(newVal){ |
134 | if (this._layerEditable.value !== newVal) { | ||
135 | this._layerEditable.value = newVal; | ||
136 | } | ||
137 | if (this._layerName !== newVal) { | ||
138 | this._layerName = newVal; | ||
139 | } | ||
140 | if (this.layerData.layerName !== newVal) { | ||
141 | this.layerData.layerName = newVal; | ||
142 | } | ||
103 | 143 | ||
104 | this._layerEditable.value = newVal; | ||
105 | this._layerName = newVal; | ||
106 | this.layerData.layerName = newVal; | ||
107 | if (typeof(this.dynamicLayerName) !== "undefined") { | 144 | if (typeof(this.dynamicLayerName) !== "undefined") { |
108 | this.dynamicLayerName.value = newVal; | 145 | if (this.dynamicLayerName.value !== newVal) { |
146 | this.dynamicLayerName.value = newVal; | ||
147 | } | ||
109 | } | 148 | } |
149 | this.needsDraw = true; | ||
110 | } | 150 | } |
111 | }, | 151 | }, |
112 | _layerID:{ | 152 | _layerID:{ |
@@ -150,6 +190,20 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
150 | } | 190 | } |
151 | }, | 191 | }, |
152 | 192 | ||
193 | _stageElement: { | ||
194 | value: null | ||
195 | }, | ||
196 | |||
197 | stageElement: { | ||
198 | get: function() { | ||
199 | return this._stageElement; | ||
200 | }, | ||
201 | set: function(newVal) { | ||
202 | this._stageElement = newVal; | ||
203 | this.layerData.stageElement = newVal; | ||
204 | } | ||
205 | }, | ||
206 | |||
153 | 207 | ||
154 | _elementsList : { | 208 | _elementsList : { |
155 | value: [] | 209 | value: [] |
@@ -164,7 +218,7 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
164 | } | 218 | } |
165 | }, | 219 | }, |
166 | 220 | ||
167 | /* Position and Transform hottext values */ | 221 | /* Position and Size hottext values */ |
168 | _dtextPositionX : { | 222 | _dtextPositionX : { |
169 | value:null | 223 | value:null |
170 | }, | 224 | }, |
@@ -179,7 +233,6 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
179 | this._dtextPositionX = value; | 233 | this._dtextPositionX = value; |
180 | this.layerData.dtextPositionX = value; | 234 | this.layerData.dtextPositionX = value; |
181 | } | 235 | } |
182 | |||
183 | } | 236 | } |
184 | }, | 237 | }, |
185 | 238 | ||
@@ -237,60 +290,6 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
237 | } | 290 | } |
238 | }, | 291 | }, |
239 | 292 | ||
240 | _dtextSkewX : { | ||
241 | value:null | ||
242 | }, | ||
243 | |||
244 | dtextSkewX:{ | ||
245 | serializable: true, | ||
246 | get:function(){ | ||
247 | return this._dtextSkewX; | ||
248 | }, | ||
249 | set:function(value){ | ||
250 | if (this._dtextSkewX !== value) { | ||
251 | this._dtextSkewX = value; | ||
252 | this.layerData.dtextSkewX = value; | ||
253 | } | ||
254 | |||
255 | } | ||
256 | }, | ||
257 | |||
258 | _dtextSkewY : { | ||
259 | value:null | ||
260 | }, | ||
261 | |||
262 | dtextSkewY:{ | ||
263 | serializable: true, | ||
264 | get:function(){ | ||
265 | return this._dtextSkewY; | ||
266 | }, | ||
267 | set:function(value){ | ||
268 | if (this._dtextSkewY !== value) { | ||
269 | this._dtextSkewY = value; | ||
270 | this.layerData.dtextSkewY = value; | ||
271 | } | ||
272 | |||
273 | } | ||
274 | }, | ||
275 | |||
276 | _dtextRotate : { | ||
277 | value:null | ||
278 | }, | ||
279 | |||
280 | dtextRotate:{ | ||
281 | serializable: true, | ||
282 | get:function(){ | ||
283 | return this._dtextRotate; | ||
284 | }, | ||
285 | set:function(value){ | ||
286 | if (this._dtextRotate !== value) { | ||
287 | this._dtextRotate = value; | ||
288 | this.layerData.dtextRotate = value; | ||
289 | } | ||
290 | |||
291 | } | ||
292 | }, | ||
293 | |||
294 | /* isSelected: whether or not the layer is currently selected. */ | 293 | /* isSelected: whether or not the layer is currently selected. */ |
295 | _isSelected:{ | 294 | _isSelected:{ |
296 | value: false | 295 | value: false |
@@ -306,6 +305,10 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
306 | if (value === false) { | 305 | if (value === false) { |
307 | // If changing from true to false, we need to deselect any associated styles | 306 | // If changing from true to false, we need to deselect any associated styles |
308 | this.selectStyle(false); | 307 | this.selectStyle(false); |
308 | } else { | ||
309 | if (this._storedStyleIndex !== false) { | ||
310 | this.selectStyle(this._storedStyleIndex); | ||
311 | } | ||
309 | } | 312 | } |
310 | this._isSelected = value; | 313 | this._isSelected = value; |
311 | this.layerData.isSelected = value; | 314 | this.layerData.isSelected = value; |
@@ -365,6 +368,41 @@ var Layer = exports.Layer = Montage.create(Component, { | |||
365 | this.layerData.isVisible = value; | 368 | this.layerData.isVisible = value; |
366 | } | 369 | } |
367 | }, | 370 | }, |
371 | |||
372 | _isLock:{ | ||
373 | value: false | ||
374 | }, | ||
375 | |||
376 | isLock:{ | ||
377 | get:function(){ | ||
378 | return this._isLock; | ||
379 | }, | ||
380 | set:function(value){ | ||
381 | if (this._isLock !== value) { | ||
382 | this._isLock = value; | ||
383 |