From 631c9750e5ad6d7739d8683c31aa3a9f8f3b4e4c Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Tue, 28 Feb 2012 15:01:41 -0800 Subject: Timeline: Fix Selection , Partially Fix adding element to an already animated track with one element Signed-off-by: Kruti Shah --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 27 ++++++++++++++++++---- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 01b03531..81415951 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -256,6 +256,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) { this._openDoc=true; + this._captureSelection=true; NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) myIndex++; } @@ -579,7 +580,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.arrTracks.splice(myIndex, 0, newTrack); this.arrLayers.splice(myIndex, 0, thingToPush); this._LayerUndoPosition = myIndex; -// this.selectLayer(myIndex); + this.selectLayer(myIndex); this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); @@ -592,7 +593,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); -// this.selectLayer(0); + this.selectLayer(0); } @@ -722,9 +723,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleElementAdded:{ value:function (event) { + event.detail.uuid=nj.generateRandom(); - this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); - this.currentLayerSelected.elementsList.push(event.detail); + if(this.currentLayerSelected.elementsList[0]!==undefined){ + if(this.currentTrackSelected.isTrackAnimated){ + this.application.ninja.stage.clearDrawingCanvas(); + alert("cannot add elements to a layer with animated element");/* check how to clear the canvas*/ + return; + }else{ + this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); + this.currentLayerSelected.elementsList.push(event.detail); + } + }else{ + this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); + this.currentLayerSelected.elementsList.push(event.detail); + } } }, @@ -948,7 +961,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.currentTrackSelected = this.arrTracks[layerIndex]; if(!this._openDoc){ if(this._captureSelection){ - this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList) + if(this.currentLayerSelected.elementsList.length >= 1){ + this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList); + }else{ + this.application.ninja.selectionController.executeSelectElement(); + } } this._captureSelection = true; } diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 43cd7477..bf97c0fd 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -519,6 +519,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { i++; this.nextKeyframe += 1; } + this.isTrackAnimated = true; } } else{ -- cgit v1.2.3