aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel
diff options
context:
space:
mode:
authorKruti Shah2012-03-05 11:59:31 -0800
committerKruti Shah2012-03-05 11:59:31 -0800
commit11f39321cf1f2b5f3790ed819051f56411e98261 (patch)
treefab78a77da2114331547777928aa4ad5fbb49cd1 /js/panels/Timeline/TimelinePanel.reel
parent59561ec3490c743aab73a17273177e5db7be253e (diff)
downloadninja-11f39321cf1f2b5f3790ed819051f56411e98261.tar.gz
Timeline: Removing Events for Adding and Deleting Layer, Taking care of BreadCrumb
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js326
1 files changed, 141 insertions, 185 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 93fd170e..48181ae7 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -156,6 +156,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
156 } 156 }
157 }, 157 },
158 158
159 _breadCrumbContainer:{
160 value:null
161 },
162
163 breadCrumbContainer: {
164 set: function(value) {
165 if(this._breadCrumbContainer !== value) {
166 this._breadCrumbContainer = value;
167 this.LayerBinding(this.application.ninja.currentSelectedContainer);
168 }
169 },
170 get: function() {
171 return this._breadCrumbContainer;
172 }
173 },
174
159 _isLayer:{ 175 _isLayer:{
160 value:false 176 value:false
161 }, 177 },
@@ -221,6 +237,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
221 for (i = 0; i < arrEventsLength; i++) { 237 for (i = 0; i < arrEventsLength; i++) {
222 this.eventManager.addEventListener(arrEvents[i], this, false); 238 this.eventManager.addEventListener(arrEvents[i], this, false);
223 } 239 }
240 Object.defineBinding(this, "breadCrumbContainer", {
241 boundObject: this.application.ninja,
242 boundObjectPropertyPath:"currentSelectedContainer",
243 oneway: true
244 });
224 } 245 }
225 } 246 }
226 }, 247 },
@@ -247,8 +268,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
247 value:function () { 268 value:function () {
248 var myIndex; 269 var myIndex;
249 this.drawTimeMarkers(); 270 this.drawTimeMarkers();
250 this._hashKey = "123"; 271 this._hashKey = this.application.ninja.currentSelectedContainer.uuid;
251
252 // Document switching 272 // Document switching
253 // Check to see if we have saved timeline information in the currentDocument. 273 // Check to see if we have saved timeline information in the currentDocument.
254 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { 274 if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") {
@@ -268,16 +288,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
268 while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) 288 while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
269 { 289 {
270 this._openDoc=true; 290 this._openDoc=true;
271 NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) 291 this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]);
272 myIndex++; 292 myIndex++;
273 } 293 }
274 } 294 }
275 else{ 295 else{
276 NJevent('newLayer', this._hashKey); 296 this.restoreLayer(1);
277 this.selectLayer(0); 297 this.selectLayer(0);
278 } 298 }
279 }else{ 299 }else{
280 NJevent('newLayer', this._hashKey); 300 this.createNewLayer(1);
281 this.selectLayer(0); 301 this.selectLayer(0);
282 302
283 } 303 }
@@ -332,6 +352,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
332 this.selectedTweens = []; 352 this.selectedTweens = [];
333 this._captureSelection = false; 353 this._captureSelection = false;
334 this._openDoc = false; 354 this._openDoc = false;
355 this._firstTimeLoaded=true;
335 this.end_hottext.value = 25; 356 this.end_hottext.value = 25;
336 this.updateTrackContainerWidth(); 357 this.updateTrackContainerWidth();
337 } 358 }
@@ -345,7 +366,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
345 this._bindDocumentEvents(); 366 this._bindDocumentEvents();
346 367
347 this.hashInstance = this.createLayerHashTable(); 368 this.hashInstance = this.createLayerHashTable();
348 this.hashTrackInstance = this.createTrackHashTable();
349 this.hashLayerNumber = this.createLayerNumberHash(); 369 this.hashLayerNumber = this.createLayerNumberHash();
350 this.hashElementMapToLayer = this.createElementMapToLayer(); 370 this.hashElementMapToLayer = this.createElementMapToLayer();
351 this.initTimelineForDocument(); 371 this.initTimelineForDocument();
@@ -456,34 +476,26 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
456 // nothing is selected, do not delete 476 // nothing is selected, do not delete
457 return; 477 return;
458 } 478 }
459 this._deleteKeyDown = false;
460 if (this.application.ninja.currentSelectedContainer.id === "UserContent") {
461 this._hashKey = "123";
462 }
463 this.removeLayer(); 479 this.removeLayer();
464 } 480 }
465 }, 481 },
466 482
467 handleLayerBinding:{ 483 LayerBinding:{
468 value:function (event) { 484 value:function (node) {
469 var i = 0; 485 var i = 0;
486
470 if (this._firstTimeLoaded) { 487 if (this._firstTimeLoaded) {
471 this._firstTimeLoaded = false; 488 this._firstTimeLoaded = false;
472 } else { 489 } else {
473 this.arrLayers.length = 0; 490 this.arrLayers.length = 0;
474 this.arrTracks.length = 0; 491 this.arrTracks.length = 0;
492 this._hashKey = node.uuid;
475 493
476 if (event.detail.element.id === "UserContent") {
477 this._hashKey = "123";
478 } else {
479 this._hashKey = event.detail.element.uuid;
480 }
481 if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) { 494 if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) {
482 this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey);
483 this._hashFind = true; 495 this._hashFind = true;
484 } 496 }
485 this.currentLayerNumber = 0; 497 this.currentLayerNumber = 0;
486 NJevent('newLayer', event.detail); 498 this.createNewLayer(1);
487 this.selectLayer(0); 499 this.selectLayer(0);
488 } 500 }
489 } 501 }
@@ -499,44 +511,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
499 } 511 }
500 }, 512 },
501 513
502 handleNewLayer:{ 514 createNewLayer:{
503 value:function (event) { 515 value:function(object){
504 var hashIndex = 0 , hashVariable = 0, layerResult, trackResult, layerObject, trackObject, dLayer, parentNode; 516 var hashVariable = 0;
505 if (this._hashFind) {
506 while (layerResult = this.returnedObject[hashIndex]) {
507 trackResult = this.returnedTrack[hashIndex];
508 if (layerResult.deleted !== true) {
509
510 // TODO: Help from Kruti
511 this.arrTracks.push(trackResult);
512 this.arrLayers.push(layerResult);
513
514 }
515 hashIndex++;
516 }
517 this._hashFind = false;
518 return;
519 }
520 if (event.detail._undoStatus) {
521 if (this.application.ninja.currentSelectedContainer.id === "UserContent" && event.detail._el.parentElementUUID === 123) {
522 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
523 while (dLayer[hashVariable]) {
524 if (dLayer[hashVariable]._layerID === event.detail._el._layerID) {
525 dLayer[hashVariable].deleted = false;
526
527 // TODO: Help from Kruti
528 this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track);
529 this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el);
530 this.selectLayer(event.detail._layerPosition);
531 break;
532 517
533 } 518 if (object._undoStatus) {
534 hashVariable++; 519 if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) {
535 } 520 dLayer = this.hashInstance.getItem(object._el.parentElementUUID);
536 } else if (event.detail._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) {
537 dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
538 while (dLayer[hashVariable]) { 521 while (dLayer[hashVariable]) {
539 if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { 522 if (dLayer[hashVariable]._layerID === object._el._layerID) {
540