aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-29 12:05:48 -0800
committerValerio Virgillito2012-02-29 12:05:48 -0800
commit850f3a1f7ab81ec80b6de1c49f2d2bbcbfe87c8e (patch)
treee7b3b3cf858086589008d4ce8552264249f6e4ed /js
parent1568367213e760463f3ee29a531aa345fda6bd6d (diff)
parent5f777eb88c6af30f4f22078bc18da2a5ce346b84 (diff)
downloadninja-850f3a1f7ab81ec80b6de1c49f2d2bbcbfe87c8e.tar.gz
Merge pull request #86 from imix23ways/Timeline
Timeline
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js6
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js27
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js1
3 files changed, 28 insertions, 6 deletions
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,
195 value:function(doc){ 195 value:function(doc){
196 var response = doc || null;//default just for testing 196 var response = doc || null;//default just for testing
197 if(!!response && response.success && (response.status!== 500) && !!response.uri){ 197 if(!!response && response.success && (response.status!== 500) && !!response.uri){
198
199 this.isNewFilePath = true;//path identifier flag
198 this.creatingNewFile = true;//flag for timeline to identify new file flow 200 this.creatingNewFile = true;//flag for timeline to identify new file flow
201
199 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 202 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
200 }else if(!!response && !response.success){ 203 }else if(!!response && !response.success){
201 //Todo: restrict directory path to the sandbox, in the dialog itself 204 //Todo: restrict directory path to the sandbox, in the dialog itself
@@ -224,9 +227,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
224 //TODO: Add UI to handle error codes, shouldn't be alert windows 227 //TODO: Add UI to handle error codes, shouldn't be alert windows
225 if(!!response && (response.status === 204)) { 228 if(!!response && (response.status === 204)) {
226 229
227 if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow 230 if((typeof this.isNewFilePath === 'undefined') || (this.isNewFilePath !== true)){//not from new file flow
228 this.creatingNewFile = false; 231 this.creatingNewFile = false;
229 } 232 }
233 this.isNewFilePath = false;//reset path identifier flag
230 234
231 //Sending full response object 235 //Sending full response object
232 this.openDocument(response); 236 this.openDocument(response);
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, {
256 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) 256 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
257 { 257 {
258 this._openDoc=true; 258 this._openDoc=true;
259 this._captureSelection=true;
259 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) 260 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
260 myIndex++; 261 myIndex++;
261 } 262 }
@@ -579,7 +580,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
579 this.arrTracks.splice(myIndex, 0, newTrack); 580 this.arrTracks.splice(myIndex, 0, newTrack);
580 this.arrLayers.splice(myIndex, 0, thingToPush); 581 this.arrLayers.splice(myIndex, 0, thingToPush);
581 this._LayerUndoPosition = myIndex; 582 this._LayerUndoPosition = myIndex;
582// this.selectLayer(myIndex); 583 this.selectLayer(myIndex);
583 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 584 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
584 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); 585 this.hashInstance.setItem(this._hashKey, thingToPush, myIndex);
585 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); 586 this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex);
@@ -592,7 +593,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
592 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 593 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
593 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); 594 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition);
594 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); 595 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition);
595// this.selectLayer(0); 596 this.selectLayer(0);
596 597
597 } 598 }
598 599
@@ -722,9 +723,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
722 723
723 handleElementAdded:{ 724 handleElementAdded:{
724 value:function (event) { 725 value:function (event) {
726
725 event.detail.uuid=nj.generateRandom(); 727 event.detail.uuid=nj.generateRandom();
726 this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); 728 if(this.currentLayerSelected.elementsList[0]!==undefined){
727 this.currentLayerSelected.elementsList.push(event.detail); 729 if(this.currentTrackSelected.isTrackAnimated){
730 this.application.ninja.stage.clearDrawingCanvas();
731 alert("cannot add elements to a layer with animated element");/* check how to clear the canvas*/
732 return;
733 }else{
734 this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
735 this.currentLayerSelected.elementsList.push(event.detail);
736 }
737 }else{
738 this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
739 this.currentLayerSelected.elementsList.push(event.detail);
740 }
728 741
729 } 742 }
730 }, 743 },
@@ -948,7 +961,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
948 this.currentTrackSelected = this.arrTracks[layerIndex]; 961 this.currentTrackSelected = this.arrTracks[layerIndex];
949 if(!this._openDoc){ 962 if(!this._openDoc){
950 if(this._captureSelection){ 963 if(this._captureSelection){
951 this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList) 964 if(this.currentLayerSelected.elementsList.length >= 1){
965 this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList);
966 }else{
967 this.application.ninja.selectionController.executeSelectElement();
968 }
952 } 969 }
953 this._captureSelection = true; 970 this._captureSelection = true;
954 } 971 }
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, {
519 i++; 519 i++;
520 this.nextKeyframe += 1; 520 this.nextKeyframe += 1;
521 } 521 }
522 this.isTrackAnimated = true;
522 } 523 }
523 } 524 }
524 else{ 525 else{