aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js29
1 files changed, 22 insertions, 7 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 5bae14d4..ef353490 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -118,8 +118,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
118 writable:true 118 writable:true
119 }, 119 },
120 120
121 _firstLayerDraw:{ 121 _arrLayersNonEmpty:{
122 value:false, 122 value:true,
123 writable:true 123 writable:true
124 }, 124 },
125 125
@@ -186,7 +186,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
186 event.stopPropagation(); 186 event.stopPropagation();
187 this._isLayer = true; 187 this._isLayer = true;
188 this.needsDraw = true; 188 this.needsDraw = true;
189
190 } 189 }
191 }, 190 },
192 191
@@ -237,6 +236,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
237 // Or at the end, if no layer is selected. 236 // Or at the end, if no layer is selected.
238 var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode; 237 var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode;
239 238
239 this._arrLayersNonEmpty= true;
240 if(this._hashFind){ 240 if(this._hashFind){
241 while(layerResult = this.returnedObject[hashIndex]){ 241 while(layerResult = this.returnedObject[hashIndex]){
242 trackResult=this.returnedTrack[hashIndex]; 242 trackResult=this.returnedTrack[hashIndex];
@@ -254,10 +254,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
254 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); 254 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID);
255 while(dLayer[hashVariable]){ 255 while(dLayer[hashVariable]){
256 if(dLayer[hashVariable]._layerID === event.detail._el._layerID){ 256 if(dLayer[hashVariable]._layerID === event.detail._el._layerID){
257 dLayer[hashVariable].deleted=false; 257 dLayer[hashVariable].deleted=false;
258 this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el); 258 this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el);
259 this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track); 259 this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track);
260 break; 260 break;
261 261
262 } 262 }
263 hashVariable++; 263 hashVariable++;
@@ -346,6 +346,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
346 this.arrTracks.splice(myIndex, 0, newTrack); 346 this.arrTracks.splice(myIndex, 0, newTrack);
347 this._LayerUndoPosition = myIndex; 347 this._LayerUndoPosition = myIndex;
348 this.currentLayerSelected= this.arrLayers[myIndex]; 348 this.currentLayerSelected= this.arrLayers[myIndex];
349 this.currentTrackSelected=this.arrTracks[myIndex];
349 this.layerRepetition.selectedIndexes = [myIndex]; 350 this.layerRepetition.selectedIndexes = [myIndex];
350 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); 351 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex);
351 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); 352 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex);
@@ -355,6 +356,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
355 thingToPush.layerPosition=this.arrLayers.length-1; 356 thingToPush.layerPosition=this.arrLayers.length-1;
356 newTrack.trackPosition=this.arrTracks.length-1; 357 newTrack.trackPosition=this.arrTracks.length-1;
357 this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1]; 358 this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1];
359 this.currentTrackSelected=this.arrTracks[this.arrTracks.length-1];
358 this._LayerUndoPosition = this.arrLayers.length-1; 360 this._LayerUndoPosition = this.arrLayers.length-1;
359 this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); 361 this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition);
360 this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); 362 this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition);
@@ -376,6 +378,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
376 var dLayer,dTrack,parentNode,hashVariable=0,k=0,index=0,j=0; 378 var dLayer,dTrack,parentNode,hashVariable=0,k=0,index=0,j=0;
377 379
378 if (this.arrLayers.length > 0) { 380 if (this.arrLayers.length > 0) {
381 if(this.arrLayers.length===1){
382 this._arrLayersNonEmpty=false;
383 alert("cannot delete further");
384 return;
385 }
379 if(event.detail._undoStatus){ 386 if(event.detail._undoStatus){
380 if(this.application.ninja.currentSelectedContainer.id==="UserContent" && event.detail._el.parentElementUUID===123 ){ 387 if(this.application.ninja.currentSelectedContainer.id==="UserContent" && event.detail._el.parentElementUUID===123 ){
381 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); 388 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID);
@@ -517,7 +524,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
517 this.layerElement=event.detail; 524 this.layerElement=event.detail;
518 if(!!this.layerRepetition.selectedIndexes){ 525 if(!!this.layerRepetition.selectedIndexes){
519 this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; 526 this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes];
527 this.currentTrackSelected = this.arrTracks[this.layerRepetition.selectedIndexes];
528 if(this.currentTrackSelected.isAnimated){
529 alert("cannot add divs an further since the track is animated");
530 }else{
520 this.currentLayerSelected.element.push(event.detail) 531 this.currentLayerSelected.element.push(event.detail)
532 }
521 } 533 }
522 else{ 534 else{
523 this.currentLayerSelected.element.push(event.detail); 535 this.currentLayerSelected.element.push(event.detail);
@@ -728,7 +740,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
728 cmd._undoStatus = this._LayerUndoStatus; 740 cmd._undoStatus = this._LayerUndoStatus;
729 cmd._track = this._TrackUndoObject; 741 cmd._track = this._TrackUndoObject;
730 742
743 if(this._arrLayersNonEmpty){
731 NJevent("sendToUndo", cmd); 744 NJevent("sendToUndo", cmd);
745 }
732 746
733 747
734 } 748 }
@@ -752,6 +766,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
752 766
753 execute: { 767 execute: {
754 value: function() { 768 value: function() {
769
755 NJevent('newLayer',this) 770 NJevent('newLayer',this)
756 771
757 } 772 }