diff options
author | Kruti Shah | 2012-02-07 23:05:28 -0800 |
---|---|---|
committer | Kruti Shah | 2012-02-07 23:05:28 -0800 |
commit | 2cfa420f48735e2718cd0824d4e945c72158d0fa (patch) | |
tree | 8761a82208b00760d91b7c2f92c197d1b404d754 | |
parent | 5bc386c6126e3c6669dd1b524d79c91358716412 (diff) | |
download | ninja-2cfa420f48735e2718cd0824d4e945c72158d0fa.tar.gz |
Timeline : Adding functionality to unable deletion when a single layer remaining & when track is animated
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 0a4a096f..31bdd217 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,14 +186,12 @@ 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 | ||
193 | handleDeleteLayerClick:{ | 192 | handleDeleteLayerClick:{ |
194 | value:function(event){ | 193 | value:function(event){ |
195 | event.stopPropagation(); | 194 | event.stopPropagation(); |
196 | this._deleteKeyDown=false; | ||
197 | if(this.application.ninja.currentSelectedContainer.id==="UserContent"){ | 195 | if(this.application.ninja.currentSelectedContainer.id==="UserContent"){ |
198 | this._hashKey="123"; | 196 | this._hashKey="123"; |
199 | } | 197 | } |
@@ -237,6 +235,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
237 | // Or at the end, if no layer is selected. | 235 | // Or at the end, if no layer is selected. |
238 | var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode; | 236 | var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode; |
239 | 237 | ||
238 | this._arrLayersNonEmpty= true; | ||
240 | if(this._hashFind){ | 239 | if(this._hashFind){ |
241 | while(layerResult = this.returnedObject[hashIndex]){ | 240 | while(layerResult = this.returnedObject[hashIndex]){ |
242 | trackResult=this.returnedTrack[hashIndex]; | 241 | trackResult=this.returnedTrack[hashIndex]; |
@@ -254,10 +253,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
254 | dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); | 253 | dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); |
255 | while(dLayer[hashVariable]){ | 254 | while(dLayer[hashVariable]){ |
256 | if(dLayer[hashVariable]._layerID === event.detail._el._layerID){ | 255 | if(dLayer[hashVariable]._layerID === event.detail._el._layerID){ |
257 | dLayer[hashVariable].deleted=false; | 256 | dLayer[hashVariable].deleted=false; |
258 | this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el); | 257 | this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el); |
259 | this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track); | 258 | this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track); |
260 | break; | 259 | break; |
261 | 260 | ||
262 | } | 261 | } |
263 | hashVariable++; | 262 | hashVariable++; |
@@ -346,6 +345,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
346 | this.arrTracks.splice(myIndex, 0, newTrack); | 345 | this.arrTracks.splice(myIndex, 0, newTrack); |
347 | this._LayerUndoPosition = myIndex; | 346 | this._LayerUndoPosition = myIndex; |
348 | this.currentLayerSelected= this.arrLayers[myIndex]; | 347 | this.currentLayerSelected= this.arrLayers[myIndex]; |
348 | this.currentTrackSelected=this.arrTracks[myIndex]; | ||
349 | this.layerRepetition.selectedIndexes = [myIndex]; | 349 | this.layerRepetition.selectedIndexes = [myIndex]; |
350 | this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); | 350 | this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); |
351 | this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); | 351 | this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); |
@@ -355,6 +355,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
355 | thingToPush.layerPosition=this.arrLayers.length-1; | 355 | thingToPush.layerPosition=this.arrLayers.length-1; |
356 | newTrack.trackPosition=this.arrTracks.length-1; | 356 | newTrack.trackPosition=this.arrTracks.length-1; |
357 | this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1]; | 357 | this.currentLayerSelected= this.arrLayers[this.arrLayers.length-1]; |
358 | this.currentTrackSelected=this.arrTracks[this.arrTracks.length-1]; | ||
358 | this._LayerUndoPosition = this.arrLayers.length-1; | 359 | this._LayerUndoPosition = this.arrLayers.length-1; |
359 | this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); | 360 | this.hashInstance.setItem(this._hashKey,thingToPush,thingToPush.layerPosition); |
360 | this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); | 361 | this.hashTrackInstance.setItem(this._hashKey,newTrack,newTrack.trackPosition); |
@@ -376,6 +377,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
376 | var dLayer,dTrack,parentNode,hashVariable=0,k=0,index=0,j=0; | 377 | var dLayer,dTrack,parentNode,hashVariable=0,k=0,index=0,j=0; |
377 | 378 | ||
378 | if (this.arrLayers.length > 0) { | 379 | if (this.arrLayers.length > 0) { |
380 | if(this.arrLayers.length===1){ | ||
381 | this._arrLayersNonEmpty=false; | ||
382 | alert("cannot delete further"); | ||
383 | return; | ||
384 | } | ||
379 | if(event.detail._undoStatus){ | 385 | if(event.detail._undoStatus){ |
380 | if(this.application.ninja.currentSelectedContainer.id==="UserContent" && event.detail._el.parentElementUUID===123 ){ | 386 | if(this.application.ninja.currentSelectedContainer.id==="UserContent" && event.detail._el.parentElementUUID===123 ){ |
381 | dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); | 387 | dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID); |
@@ -517,7 +523,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
517 | this.layerElement=event.detail; | 523 | this.layerElement=event.detail; |
518 | if(!!this.layerRepetition.selectedIndexes){ | 524 | if(!!this.layerRepetition.selectedIndexes){ |
519 | this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; | 525 | this.currentLayerSelected = this.arrLayers[this.layerRepetition.selectedIndexes]; |
526 | this.currentTrackSelected = this.arrTracks[this.layerRepetition.selectedIndexes]; | ||
527 | if(this.currentTrackSelected.isAnimated){ | ||
528 | alert("cannot add divs an further since the track is animated"); | ||
529 | }else{ | ||
520 | this.currentLayerSelected.element.push(event.detail) | 530 | this.currentLayerSelected.element.push(event.detail) |
531 | } | ||
521 | } | 532 | } |
522 | else{ | 533 | else{ |
523 | this.currentLayerSelected.element.push(event.detail); | 534 | this.currentLayerSelected.element.push(event.detail); |
@@ -728,7 +739,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
728 | cmd._undoStatus = this._LayerUndoStatus; | 739 | cmd._undoStatus = this._LayerUndoStatus; |
729 | cmd._track = this._TrackUndoObject; | 740 | cmd._track = this._TrackUndoObject; |
730 | 741 | ||
742 | if(this._arrLayersNonEmpty){ | ||
731 | NJevent("sendToUndo", cmd); | 743 | NJevent("sendToUndo", cmd); |
744 | } | ||
732 | 745 | ||
733 | 746 | ||
734 | } | 747 | } |
@@ -752,6 +765,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
752 | 765 | ||
753 | execute: { | 766 | execute: { |
754 | value: function() { | 767 | value: function() { |
768 | |||
755 | NJevent('newLayer',this) | 769 | NJevent('newLayer',this) |
756 | 770 | ||
757 | } | 771 | } |