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 From 72c3277e5b03343afc043c033fecda95b6c229bc Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 29 Feb 2012 07:39:03 -0800 Subject: fix for creatingNewFile flag Signed-off-by: Ananya Sen Signed-off-by: Jonathan Duran --- js/controllers/document-controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 02031922..64ff2c7e 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -195,7 +195,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value:function(doc){ var response = doc || null;//default just for testing if(!!response && response.success && (response.status!== 500) && !!response.uri){ + + this.isNewFilePath = true;//path identifier flag this.creatingNewFile = true;//flag for timeline to identify new file flow + this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); }else if(!!response && !response.success){ //Todo: restrict directory path to the sandbox, in the dialog itself @@ -224,9 +227,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, //TODO: Add UI to handle error codes, shouldn't be alert windows if(!!response && (response.status === 204)) { - if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow + if((typeof this.isNewFilePath === 'undefined') || (this.isNewFilePath !== true)){//not from new file flow this.creatingNewFile = false; } + this.isNewFilePath = false;//reset path identifier flag //Sending full response object this.openDocument(response); -- cgit v1.2.3