diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 76 |
1 files changed, 51 insertions, 25 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 8f7c63bf..9904a563 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -115,6 +115,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
115 | this.eventManager.addEventListener("deleteSelection", this, false); | 115 | this.eventManager.addEventListener("deleteSelection", this, false); |
116 | this.hashInstance=this.createLayerHashTable(); | 116 | this.hashInstance=this.createLayerHashTable(); |
117 | this.hashTrackInstance=this.createTrackHashTable(); | 117 | this.hashTrackInstance=this.createTrackHashTable(); |
118 | this.hashLayerNumber = this.createLayerNumberHash(); | ||
118 | this.initTimelineView(); | 119 | this.initTimelineView(); |
119 | } | 120 | } |
120 | }, | 121 | }, |
@@ -184,7 +185,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
184 | 185 | ||
185 | updateLayerScroll:{ | 186 | updateLayerScroll:{ |
186 | value:function(){ | 187 | value:function(){ |
187 | console.log(this.layout_tracks.scrollLeft) | ||
188 | this.user_layers.scrollTop = this.layout_tracks.scrollTop; | 188 | this.user_layers.scrollTop = this.layout_tracks.scrollTop; |
189 | this.layout_markers.scrollLeft = this.layout_tracks.scrollLeft; | 189 | this.layout_markers.scrollLeft = this.layout_tracks.scrollLeft; |
190 | } | 190 | } |
@@ -228,6 +228,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
228 | this._firstTimeLoaded=false; | 228 | this._firstTimeLoaded=false; |
229 | }else{ | 229 | }else{ |
230 | while(this.arrLayers.pop()){ | 230 | while(this.arrLayers.pop()){ |
231 | |||
231 | } | 232 | } |
232 | while(this.arrTracks.pop()){ | 233 | while(this.arrTracks.pop()){ |
233 | } | 234 | } |
@@ -242,7 +243,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
242 | this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey); | 243 | this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey); |
243 | this._hashFind = true; | 244 | this._hashFind = true; |
244 | } | 245 | } |
246 | this.currentLayerNumber = 0; | ||
245 | NJevent('newLayer',event.detail); | 247 | NJevent('newLayer',event.detail); |
248 | this.selectLayer(0); | ||
249 | |||
246 | 250 | ||
247 | } | 251 | } |
248 | 252 | ||
@@ -338,6 +342,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
338 | 342 | ||
339 | // Build the thingToPush object | 343 | // Build the thingToPush object |
340 | 344 | ||
345 | this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); | ||
346 | if(this.currentLayerNumber===undefined){ | ||
347 | this.currentLayerNumber = 0 ; | ||
348 | } | ||
341 | this.currentLayerNumber = this.currentLayerNumber +1; | 349 | this.currentLayerNumber = this.currentLayerNumber +1; |
342 | newLayerName = "Layer " + this.currentLayerNumber; | 350 | newLayerName = "Layer " + this.currentLayerNumber; |
343 | thingToPush.layerName = newLayerName; | 351 | thingToPush.layerName = newLayerName; |
@@ -395,19 +403,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
395 | } | 403 | } |
396 | this.layerRepetition.selectedIndexes = [myIndex]; | 404 | this.layerRepetition.selectedIndexes = [myIndex]; |
397 | */ | 405 | */ |
398 | 406 | this.selectLayer(myIndex); | |
399 | this.selectLayer(myIndex); | 407 | this.hashLayerNumber.setItem(this._hashKey,thingToPush); |
400 | |||
401 | this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); | 408 | this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); |
402 | this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); | 409 | this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); |
410 | |||
403 | } else { | 411 | } else { |
404 | this.arrLayers.splice(0, 0, thingToPush); | 412 | this.arrLayers.splice(0, 0, thingToPush); |
405 | this.arrTracks.splice(0, 0, newTrack); | 413 | this.arrTracks.splice(0, 0, newTrack); |
406 | thingToPush.layerPosition=this.arrLayers.length-1; | 414 | thingToPush.layerPosition=this.arrLayers.length-1; |
407 | newTrack.trackPosition=this.arrTracks.length-1; | 415 | newTrack.trackPosition=this.arrTracks.length-1; |
408 | this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1]; | ||
409 | this.currentTrackSelected=this.arrTracks[this.arrTracks.length-1]; | ||
410 | this._LayerUndoPosition = this.arrLayers.length-1; | 416 | this._LayerUndoPosition = this.arrLayers.length-1; |
417 | this.hashLayerNumber.setItem(this._hashKey,thingToPush); | ||
411 | this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); | 418 | this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); |
412 | this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); | 419 | this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); |
413 | 420 | ||
@@ -416,8 +423,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
416 | this._LayerUndoIndex = thingToPush.layerID ; | 423 | this._LayerUndoIndex = thingToPush.layerID ; |
417 | this._LayerUndoStatus = true; | 424 | this._LayerUndoStatus = true; |
418 | this._TrackUndoObject = newTrack; | 425 | this._TrackUndoObject = newTrack; |
426 | } | ||
419 | 427 | ||
420 | } | ||
421 | 428 | ||
422 | 429 | ||
423 | } | 430 | } |
@@ -571,19 +578,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
571 | 578 | ||
572 | handleElementAdded: { | 579 | handleElementAdded: { |
573 | value: function(event) { | 580 | value: function(event) { |
574 | this.layerElement=event.detail; | 581 | |
575 | if(!!this.layerRepetition.selectedIndexes){ | 582 | this.currentLayerSelected.element.push(event.detail) |
576 | this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; | 583 | |
577 | this.currentTrackSelected = this.arrTracks[this.layerRepetition.selectedIndexes]; | 584 | |
578 | if(this.currentTrackSelected.isAnimated){ | ||
579 | alert("cannot add divs an further since the track is animated"); | ||
580 | }else{ | ||
581 | this.currentLayerSelected.element.push(event.detail) | ||
582 | } | ||
583 | } | ||
584 | else{ | ||
585 | this.currentLayerSelected.element.push(event.detail); | ||
586 | } | ||
587 | } | 585 | } |
588 | }, | 586 | }, |
589 | 587 | ||
@@ -608,10 +606,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
608 | value: function(event) { | 606 | value: function(event) { |
609 | var length; | 607 | var length; |
610 | this.deleteElement = event.detail; | 608 | this.deleteElement = event.detail; |
611 | |||
612 | if(!!this.layerRepetition.selectedIndexes){ | ||
613 | this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; | ||
614 | } | ||
615 | length =this.currentLayerSelected.element.length-1; | 609 | length =this.currentLayerSelected.element.length-1; |
616 | while(length >= 0){ | 610 | while(length >= 0){ |
617 | if(this.currentLayerSelected.element[length]===this.deleteElement){ | 611 | if(this.currentLayerSelected.element[length]===this.deleteElement){ |
@@ -679,7 +673,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
679 | writable:true | 673 | writable:true |
680 | }, | 674 | }, |
681 | 675 | ||
682 | setItem: { | 676 | setItem: { |
683 | value: function(key,value,index) { | 677 | value: function(key,value,index) { |
684 | // console.log(this.application.ninja.currentSelectedContainer) | 678 | // console.log(this.application.ninja.currentSelectedContainer) |
685 | if(hashLayerObject[key]===undefined){ | 679 | if(hashLayerObject[key]===undefined){ |
@@ -708,6 +702,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
708 | return hashLayerObject[key]; | 702 | return hashLayerObject[key]; |
709 | } | 703 | } |
710 | } | 704 | } |
705 | |||
711 | }); | 706 | }); |
712 | 707 | ||
713 | return hashLayerObject; | 708 | return hashLayerObject; |
@@ -729,6 +724,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
729 | value: function(key,value,index) { | 724 | value: function(key,value,index) { |
730 | if(hashTrackObject[key]===undefined){ | 725 | if(hashTrackObject[key]===undefined){ |
731 | hashTrackObject[key]={}; | 726 | hashTrackObject[key]={}; |
727 | |||
732 | } | 728 | } |
733 | 729 | ||
734 | if(hashTrackObject[key][index]!== undefined){ | 730 | if(hashTrackObject[key][index]!== undefined){ |
@@ -754,12 +750,42 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
754 | return hashTrackObject[key]; | 750 | return hashTrackObject[key]; |
755 | } | 751 | } |
756 | } | 752 | } |
753 | |||
754 | |||
757 | }); | 755 | }); |
758 | 756 | ||
759 | return hashTrackObject; | 757 | return hashTrackObject; |
760 | 758 | ||
761 | } | 759 | } |
762 | }, | 760 | }, |
761 | createLayerNumberHash:{ | ||
762 | value:function(key,value){ | ||
763 | var hashLayerNumberObject ; | ||
764 | |||
765 | hashLayerNumberObject = Object.create(Object.prototype, { | ||
766 | |||
767 | setItem: { | ||
768 | value: function(key,value) { | ||
769 | if(value!==undefined){ | ||
770 | |||
771 | hashLayerNumberObject[key]= value.layerID ; | ||
772 | |||