diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r--[-rwxr-xr-x] | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 102 |
1 files changed, 71 insertions, 31 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 07fee19d..43e758f4 100755..100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -65,6 +65,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
65 | value:1000 | 65 | value:1000 |
66 | }, | 66 | }, |
67 | 67 | ||
68 | _masterDuration:{ | ||
69 | serializable: true, | ||
70 | value:0 | ||
71 | }, | ||
72 | |||
73 | masterDuration:{ | ||
74 | serializable:true, | ||
75 | get:function(){ | ||
76 | return this._masterDuration; | ||
77 | }, | ||
78 | set:function(val){ | ||
79 | this._masterDuration = val; | ||
80 | this.timebar.style.width = (this._masterDuration / 12) + "px"; | ||
81 | } | ||
82 | }, | ||
83 | |||
68 | _arrTracks:{ | 84 | _arrTracks:{ |
69 | serializable:true, | 85 | serializable:true, |
70 | value:[] | 86 | value:[] |
@@ -109,6 +125,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
109 | } | 125 | } |
110 | }, | 126 | }, |
111 | 127 | ||
128 | _selectedTweens:{ | ||
129 | value:[] | ||
130 | }, | ||
131 | |||
132 | selectedTweens:{ | ||
133 | serializable:true, | ||
134 | get:function () { | ||
135 | return this._selectedTweens; | ||
136 | }, | ||
137 | set:function (newVal) { | ||
138 | this._selectedTweens = newVal; | ||
139 | } | ||
140 | }, | ||
141 | |||
112 | _isLayer:{ | 142 | _isLayer:{ |
113 | value:false | 143 | value:false |
114 | }, | 144 | }, |
@@ -234,13 +264,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
234 | } | 264 | } |
235 | }, | 265 | }, |
236 | 266 | ||
237 | deselectKeyframes:{ | 267 | deselectTweens:{ |
238 | value:function () { | 268 | value:function () { |
239 | for (var i = 0; i < this.selectedKeyframes.length; i++) { | 269 | for (var i = 0; i < this.selectedTweens.length; i++) { |
240 | this.selectedKeyframes[i].deselect(); | 270 | this.selectedTweens[i].deselectTween(); |
241 | } | 271 | } |
242 | this.selectedKeyframes = null; | 272 | this.selectedTweens = null; |
243 | this.selectedKeyframes = new Array(); | 273 | this.selectedTweens = new Array(); |
244 | } | 274 | } |
245 | }, | 275 | }, |
246 | 276 | ||
@@ -253,6 +283,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
253 | 283 | ||
254 | handleDeleteLayerClick:{ | 284 | handleDeleteLayerClick:{ |
255 | value:function (event) { | 285 | value:function (event) { |
286 | if (this.arrLayers.length === 1) { | ||
287 | // do not delete last layer | ||
288 | return; | ||
289 | } | ||
290 | if (this.layerRepetition.selectedIndexes === null) { | ||
291 | // nothing is selected, do not delete | ||
292 | return; | ||
293 | } | ||
256 | this._deleteKeyDown = false; | 294 | this._deleteKeyDown = false; |
257 | if (this.application.ninja.currentSelectedContainer.id === "UserContent") { | 295 | if (this.application.ninja.currentSelectedContainer.id === "UserContent") { |
258 | this._hashKey = "123"; | 296 | this._hashKey = "123"; |
@@ -269,10 +307,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
269 | if (this._firstTimeLoaded) { | 307 | if (this._firstTimeLoaded) { |
270 | this._firstTimeLoaded = false; | 308 | this._firstTimeLoaded = false; |
271 | } else { | 309 | } else { |
272 | while (this.arrLayers.pop()) { | 310 | this.arrLayers.length = 0; |
273 | } | 311 | this.arrTracks.length = 0; |
274 | while (this.arrTracks.pop()) { | 312 | |
275 | } | ||
276 | if (event.detail.element.id === "UserContent") { | 313 | if (event.detail.element.id === "UserContent") { |
277 | this._hashKey = "123"; | 314 | this._hashKey = "123"; |
278 | } else { | 315 | } else { |
@@ -308,8 +345,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
308 | while (layerResult = this.returnedObject[hashIndex]) { | 345 | while (layerResult = this.returnedObject[hashIndex]) { |
309 | trackResult = this.returnedTrack[hashIndex]; | 346 | trackResult = this.returnedTrack[hashIndex]; |
310 | if (layerResult.deleted !== true) { | 347 | if (layerResult.deleted !== true) { |
311 | this.arrLayers.push(layerResult); | ||
312 | this.arrTracks.push(trackResult); | 348 | this.arrTracks.push(trackResult); |
349 | this.arrLayers.push(layerResult); | ||
350 | |||
313 | } | 351 | } |
314 | hashIndex++; | 352 | hashIndex++; |
315 | } | 353 | } |
@@ -322,8 +360,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
322 | while (dLayer[hashVariable]) { | 360 | while (dLayer[hashVariable]) { |
323 | if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { | 361 | if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { |
324 | dLayer[hashVariable].deleted = false; | 362 | dLayer[hashVariable].deleted = false; |
325 | this.arrLayers.splice(event.detail._layerPosition, 1, event.detail._el); | 363 | this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); |
326 | this.arrTracks.splice(event.detail._layerPosition, 1, event.detail._track); | 364 | this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); |
365 | |||
327 | break; | 366 | break; |
328 | 367 | ||
329 | } | 368 | } |
@@ -349,8 +388,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
349 | while (dLayer[hashVariable]) { | 388 | while (dLayer[hashVariable]) { |
350 | if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { | 389 | if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { |
351 | dLayer[hashVariable].deleted = false; | 390 | dLayer[hashVariable].deleted = false; |
352 | this.arrLayers.splice(event.detail._layerPosition, 1, event.detail._el); | 391 | this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); |
353 | this.arrTracks.splice(event.detail._layerPosition, 1, event.detail._track); | 392 | this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); |
354 | break; | 393 | break; |
355 | 394 | ||
356 | } | 395 | } |
@@ -387,12 +426,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
387 | thingToPush.parentElement = this.application.ninja.currentSelectedContainer; | 426 | thingToPush.parentElement = this.application.ninja.currentSelectedContainer; |
388 | } | 427 | } |
389 | 428 | ||
390 | |||
391 | newTrack.trackID = this.currentLayerNumber; | 429 | newTrack.trackID = this.currentLayerNumber; |
392 | newTrack.isMainCollapsed = true; | 430 | newTrack.isMainCollapsed = true; |
393 | newTrack.isPositionCollapsed = true; | 431 | newTrack.isPositionCollapsed = true; |
394 | newTrack.isTransformCollapsed = true; | 432 | newTrack.isTransformCollapsed = true; |
395 | newTrack.isStyleCollapsed = false; | 433 | newTrack.isStyleCollapsed = true; |
434 | newTrack.isTrackAnimated = false; | ||
435 | newTrack.currentKeyframeRule = null; | ||
436 | newTrack.trackPosition = 0; | ||
437 | newTrack.arrStyleTracks = []; | ||
396 | newTrack.tweens = []; | 438 | newTrack.tweens = []; |
397 | 439 | ||
398 | if (_firstLayerDraw) { | 440 | if (_firstLayerDraw) { |
@@ -407,16 +449,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
407 | thingToPush.layerPosition = myIndex; | 449 | thingToPush.layerPosition = myIndex; |
408 | thingToPush.isSelected = true; | 450 | thingToPush.isSelected = true; |
409 | newTrack.trackPosition = myIndex; | 451 | newTrack.trackPosition = myIndex; |
410 | this.arrLayers.splice(myIndex, 0, thingToPush); | ||
411 | this.arrTracks.splice(myIndex, 0, newTrack); | 452 | this.arrTracks.splice(myIndex, 0, newTrack); |
453 | this.arrLayers.splice(myIndex, 0, thingToPush); | ||
412 | this._LayerUndoPosition = myIndex; | 454 | this._LayerUndoPosition = myIndex; |
413 | this.selectLayer(myIndex); | 455 | this.selectLayer(myIndex); |
414 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); | 456 | this.hashLayerNumber.setItem(this._hashKey, thingToPush); |
415 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); | 457 | this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); |
416 | this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); | 458 | this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); |
417 | } else { | 459 | } else { |
418 | this.arrLayers.splice(0, 0, thingToPush); | ||
419 | this.arrTracks.splice(0, 0, newTrack); | 460 | this.arrTracks.splice(0, 0, newTrack); |
461 | this.arrLayers.splice(0, 0, thingToPush); | ||
420 | thingToPush.layerPosition = this.arrLayers.length - 1; | 462 | thingToPush.layerPosition = this.arrLayers.length - 1; |
421 | newTrack.trackPosition = this.arrTracks.length - 1; | 463 | newTrack.trackPosition = this.arrTracks.length - 1; |
422 | this._LayerUndoPosition = this.arrLayers.length - 1; | 464 | this._LayerUndoPosition = this.arrLayers.length - 1; |
@@ -429,13 +471,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
429 | this._LayerUndoIndex = thingToPush.layerID; | 471 | this._LayerUndoIndex = thingToPush.layerID; |
430 | this._LayerUndoStatus = true; | 472 | this._LayerUndoStatus = true; |
431 | this._TrackUndoObject = newTrack; | 473 | this._TrackUndoObject = newTrack; |
432 | |||
433 | // Removing clearing the selection - Handled by the selection-controller | ||
434 | /* | ||
435 | if(_firstLayerDraw){ | 474 | if(_firstLayerDraw){ |
436 | this.application.ninja.selectionController.executeSelectElement(); | 475 | this.application.ninja.selectionController. |