aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js499
1 files changed, 322 insertions, 177 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 52b63376..48537cef 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -114,27 +114,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
114 value: false 114 value: false
115 }, 115 },
116 116
117 _isLayerAdded:{ 117 _firstTimeLoaded:{
118 value:false 118 value:true,
119 }, 119 writable:true
120
121 addButtonClicked:{
122 value:true
123 }, 120 },
124 121
125 _firstLayerDraw:{ 122 _arrLayersNonEmpty:{
126 value:false, 123 value:true,
127 writable:true 124 writable:true
128 }, 125 },
129 126
130 willDraw: { 127 willDraw: {
131 value: function() { 128 value: function() {
132 if (this._isLayer) { 129 if (this._isLayer) {
133 this.addButtonClicked=false; 130 this.insertLayer();
134 this._isElementAdded=true; 131 this._isLayer = false;;
135 NJevent('newLayer',this)
136 this._isLayer = false;
137 this.addButtonClicked=true;
138 } 132 }
139 } 133 }
140 }, 134 },
@@ -204,7 +198,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
204 //event.stopPropagation(); 198 //event.stopPropagation();
205 this._isLayer = true; 199 this._isLayer = true;
206 this.needsDraw = true; 200 this.needsDraw = true;
207
208 } 201 }
209 }, 202 },
210 203
@@ -215,7 +208,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
215 if(this.application.ninja.currentSelectedContainer.id==="UserContent"){ 208 if(this.application.ninja.currentSelectedContainer.id==="UserContent"){
216 this._hashKey="123"; 209 this._hashKey="123";
217 } 210 }
218 NJevent('deleteLayer') 211 this.removeLayer();
219 } 212 }
220 }, 213 },
221 214
@@ -223,23 +216,28 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
223 value:function(event){ 216 value:function(event){
224 var i=0; 217 var i=0;
225 this.currentParentNode=this.application.ninja.currentSelectedContainer.parentNode; 218 this.currentParentNode=this.application.ninja.currentSelectedContainer.parentNode;
226 this.removeLayerFromParentUUid = this.application.ninja.currentSelectedContainer.parentNode.uuid;
227 this.currentElement= event.detail.element;
228
229// if(this._firstLayerDraw===false){
230// while(this.arrLayers.pop()){
231// }
232// while(this.arrTracks.pop()){
233// }
234// }
235
236 this._hashKey = event.detail.element.uuid;
237 if(this.returnedObject = this.hashInstance.getItem(this._hashKey)){
238 this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey);
239 this._hashFind = true;
240 NJevent('newLayer');
241 219
242 } 220 if(this._firstTimeLoaded){
221 this._firstTimeLoaded=false;
222 }else{
223 while(this.arrLayers.pop()){
224 }
225 while(this.arrTracks.pop()){
226 }
227
228 if(event.detail.element.id==="UserContent"){
229 this._hashKey= "123";
230 }else{
231 this._hashKey = event.detail.element.uuid;
232 }
233
234 if(this.returnedObject = this.hashInstance.getItem(this._hashKey)){
235 this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey);
236 this._hashFind = true;
237 }
238 NJevent('newLayer',event.detail);
239
240 }
243 241
244 } 242 }
245 }, 243 },
@@ -276,6 +274,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
276 // Or at the end, if no layer is selected. 274 // Or at the end, if no layer is selected.
277 var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode; 275 var hashIndex =0 ,hashVariable=0,layerResult,trackResult,layerObject,trackObject,dLayer,parentNode;
278 276
277 this._arrLayersNonEmpty= true;
279 if(this._hashFind){ 278 if(this._hashFind){
280 while(layerResult = this.returnedObject[hashIndex]){ 279 while(layerResult = this.returnedObject[hashIndex]){
281 trackResult=this.returnedTrack[hashIndex]; 280 trackResult=this.returnedTrack[hashIndex];
@@ -288,40 +287,52 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
288 this._hashFind=false; 287 this._hashFind=false;
289 return; 288 return;
290 } 289 }
290 if(event.detail._undoStatus){
291 if(this.application.ninja.currentSelectedContainer.id==="UserContent" && event.detail._el.parentElementUUID===123 ){
292 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID);
293 while(dLayer[hashVariable]){
294 if(dLayer[hashVariable]._layerID === event.detail._el._layerID){
295 dLayer[hashVariable].deleted=false;
296 this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el);
297 this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track);
298 break;
299
300 }
301 hashVariable++;
302 }
291 303
304 }
305
306 else if(event.detail._el.parentElementUUID!==this.application.ninja.currentSelectedContainer.uuid){
307 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID);
308 while(dLayer[hashVariable]){
309 if(dLayer[hashVariable]._layerID===event.detail._el._layerID){
310 dLayer[hashVariable].deleted=false;
311 parentNode=dLayer[hashVariable].parentElement;
312 break;
313 }
314 hashVariable++;
315 }
316 this._setBreadCrumb=true;
317 NJevent('breadCrumbTrail',{"element":parentNode,"setFlag":this._setBreadCrumb});
318 }else{
319 dLayer=this.hashInstance.getItem(event.detail._el.parentElementUUID);
320 while(dLayer[hashVariable]){
321 if(dLayer[hashVariable]._layerID === event.detail._el._layerID){
322 dLayer[hashVariable].deleted=false;
323 this.arrLayers.splice(event.detail._layerPosition,1,event.detail._el);
324 this.arrTracks.splice(event.detail._layerPosition,1,event.detail._track);
325 break;
326
327 }
328 hashVariable++;
329 }
330 }
331 }
292 332
293// if(this.addButtonClicked){
294// layerObject = this.hashInstance.getItem(this.application.ninja.currentSelectedContainer.uuid);
295// trackObject = this.hashTrackInstance.getItem(this.application.ninja.currentSelectedContainer.uuid);
296// if(layerObject!==undefined){
297// while(layerObject[hashVariable]){
298// if(event.detail.parentElement!==this.application.ninja.currentSelectedContainer){
299// dLayer=this.hashInstance.getItem(event.detail.parentNode.uuid);
300// while(dLayer[hashVariable]){
301// if(dLayer[hashVariable].element===event.detail){
302// dLayer[hashVariable].deleted=true;
303// parentNode=dLayer[hashVariable].parentElement;
304// break;
305// }
306// hashVariable++;
307// }
308// this._setBreadCrumb=true;
309// NJevent('breadCrumbTrail',{"element":parentNode,"setFlag":this._setBreadCrumb});
310//
311// }
312// else if(layerObject[hashVariable].element===event.detail){
313// this.arrLayers.splice(layerObject[hashVariable].layerPosition,0,layerObject[hashVariable]);
314// this.arrTracks.splice(trackObject[hashVariable].trackPosition,0,trackObject[hashVariable]);
315// this._isLayerAdded=true;
316// break;
317// }
318// hashVariable++;
319// this._isLayerAdded=false;
320// }
321// }
322// }
323 333
324 334
335 else{
325 var newLayerName = "", 336 var newLay