aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJonathan Duran2012-02-09 11:43:33 -0800
committerJonathan Duran2012-02-09 11:43:33 -0800
commit180f728f833f4c9347fe5cc1cc14a35d9fb04c07 (patch)
treec07bb92cc1e2cfc6b23fcd0956b049786379421a /js/panels
parent9d398be7bab02d7c53ac0a52d1d041da27af09e7 (diff)
downloadninja-180f728f833f4c9347fe5cc1cc14a35d9fb04c07.tar.gz
Squashed commit of the following:
commit fe0d1578305db78eb5a744c354dbbb3cec67be2a Author: Kruti Shah <kruti.shah@motorola.com> Date: Thu Feb 9 11:43:53 2012 -0800 Removing a flag Signed-off-by: Kruti Shah <kruti.shah@motorola.com> commit 7a7e5d9a07c85a9a35297efe74f8b45bc4bd3c62 Author: Kruti Shah <kruti.shah@motorola.com> Date: Thu Feb 9 11:42:39 2012 -0800 Timeline : Selection Handling depending on layer selected Signed-off-by: Kruti Shah <kruti.shah@motorola.com> commit d0a4d88ddef2f1690da490cf8f3d167f1eb01945 Merge: ad214f9 f6ad57e Author: Kruti Shah <kruti.shah@motorola.com> Date: Thu Feb 9 09:54:42 2012 -0800 Merge branch 'refs/heads/Timeline' into Timeline_updated Conflicts: js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Signed-off-by: Kruti Shah <kruti.shah@motorola.com> commit ad214f9b5bc19c43eac39e4c9d93cd9645aed2ea Author: Kruti Shah <kruti.shah@motorola.com> Date: Thu Feb 9 09:40:14 2012 -0800 Timeline : When element selected the corresponding layer highlights Signed-off-by: Kruti Shah <kruti.shah@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index b3f4318a..4586c4eb 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -3,6 +3,7 @@ var Component = require("montage/ui/component").Component;
3var Layer = require("js/panels/Timeline/Layer.reel").Layer; 3var Layer = require("js/panels/Timeline/Layer.reel").Layer;
4var TimelineTrack = require("js/panels/Timeline/TimelineTrack.reel").TimelineTrack; 4var TimelineTrack = require("js/panels/Timeline/TimelineTrack.reel").TimelineTrack;
5var nj = require("js/lib/NJUtils").NJUtils; 5var nj = require("js/lib/NJUtils").NJUtils;
6var ElementMediator = require("js/mediators/element-mediator").ElementMediator;
6 7
7var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { 8var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
8 9
@@ -121,6 +122,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
121 value:true, 122 value:true,
122 writable:true 123 writable:true
123 }, 124 },
125
126 _captureSelection:{
127 value:false,
128 writable:true
129 },
124 /* === END: Models === */ 130 /* === END: Models === */
125 131
126 /* === BEGIN: Draw cycle === */ 132 /* === BEGIN: Draw cycle === */
@@ -134,9 +140,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
134 this.eventManager.addEventListener("elementAdded", this, false); 140 this.eventManager.addEventListener("elementAdded", this, false);
135 this.eventManager.addEventListener("elementDeleted", this, false); 141 this.eventManager.addEventListener("elementDeleted", this, false);
136 this.eventManager.addEventListener("deleteSelection", this, false); 142 this.eventManager.addEventListener("deleteSelection", this, false);
143 this.eventManager.addEventListener("selectionChange", this, true);
137 this.hashInstance = this.createLayerHashTable(); 144 this.hashInstance = this.createLayerHashTable();
138 this.hashTrackInstance = this.createTrackHashTable(); 145 this.hashTrackInstance = this.createTrackHashTable();
139 this.hashLayerNumber = this.createLayerNumberHash(); 146 this.hashLayerNumber = this.createLayerNumberHash();
147 this.hashElementMapToLayer = this.createElementMapToLayer();
140 this.initTimelineView(); 148 this.initTimelineView();
141 } 149 }
142 }, 150 },
@@ -182,6 +190,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
182 } 190 }
183 }, 191 },
184 192
193 captureSelectionChange:{
194 value:function(){
195 var key , switchSelectedLayer,layerIndex;
196 if(this.application.ninja.selectedElements[0]){
197 key = this.application.ninja.selectedElements[0].uuid;
198 switchSelectedLayer = this.hashElementMapToLayer.getItem(key);
199 if(switchSelectedLayer!==undefined){
200 layerIndex = this.getLayerIndexByID(switchSelectedLayer.layerID)
201 this._captureSelection=false;
202 this.selectLayer(layerIndex);
203 this._captureSelection=true;
204
205 }
206 }
207 }
208 },
209
185 updateTimeText:{ 210 updateTimeText:{
186 value:function (millisec) { 211 value:function (millisec) {
187 var timeText; 212 var timeText;
@@ -398,11 +423,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
398 this.hashLayerNumber.setItem(this._hashKey, thingToPush); 423 this.hashLayerNumber.setItem(this._hashKey, thingToPush);
399 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); 424 this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition);
400 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); 425 this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition);
426
401 } 427 }
402 this._LayerUndoObject = thingToPush; 428 this._LayerUndoObject = thingToPush;
403 this._LayerUndoIndex = thingToPush.layerID; 429 this._LayerUndoIndex = thingToPush.layerID;
404 this._LayerUndoStatus = true; 430 this._LayerUndoStatus = true;
405 this._TrackUndoObject = newTrack; 431 this._TrackUndoObject = newTrack;
432 if(_firstLayerDraw){
433 this.application.ninja.selectionController.executeSelectElement();
434 }
435
406 } 436 }
407 } 437 }
408 }, 438 },
@@ -427,6 +457,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
427 while (this.arrLayers.length) { 457 while (this.arrLayers.length) {
428 if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) { 458 if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) {
429 dLayer[hashVariable].deleted = true; 459 dLayer[hashVariable].deleted = true;
460 ElementMediator.deleteElements(dLayer[myIndex].element);
430 this.arrLayers.splice(k, 1); 461 this.arrLayers.splice(k, 1);
431 this.arrTracks.splice(k, 1); 462 this.arrTracks.splice(k, 1);
432 break; 463 break;
@@ -442,6 +473,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
442 while (dLayer[hashVariable]) { 473 while (dLayer[hashVariable]) {
443 if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { 474 if (dLayer[hashVariable]._layerID === event.detail._el._layerID) {
444 dLayer[hashVariable].deleted = true; 475 dLayer[hashVariable].deleted = true;
476 ElementMediator.deleteElements(dLayer[myIndex].element);
445 parentNode = dLayer[hashVariable].parentElement; 477 parentNode = dLayer[hashVariable].parentElement;
446 break; 478 break;
447 } 479 }
@@ -459,6 +491,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
459 while (this.arrLayers.length) { 491 while (this.arrLayers.length) {
460 if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) { 492 if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) {
461 dLayer[hashVariable].deleted = true; 493 dLayer[hashVariable].deleted = true;
494 ElementMediator.deleteElements(dLayer[myIndex].element);
462 this.arrLayers.splice(k, 1); 495 this.arrLayers.splice(k, 1);
463 this.arrTracks.splice(k, 1); 496 this.arrTracks.splice(k, 1);
464 break; 497 break;
@@ -479,6 +512,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
479 dLayer = this.hashInstance.getItem(this._hashKey); 512 dLayer = this.hashInstance.getItem(this._hashKey);
480 dTrack = this.hashTrackInstance.getItem(this._hashKey); 513 dTrack = this.hashTrackInstance.getItem(this._hashKey);
481 dLayer[myIndex].deleted = true; 514 dLayer[myIndex].deleted = true;
515 ElementMediator.deleteElements(dLayer[myIndex].element);
482 516
483 this.arrLayers.splice(myIndex, 1); 517 this.arrLayers.splice(myIndex, 1);
484 this.arrTracks.splice(myIndex, 1); 518 this.arrTracks.splice(myIndex, 1);
@@ -488,6 +522,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
488 dLayer = this.hashInstance.getItem(this._hashKey); 522 dLayer = this.hashInstance.getItem(this._hashKey);
489 dTrack = this.hashTrackInstance.getItem(this._hashKey); 523 dTrack = this.hashTrackInstance.getItem(this._hashKey);
490 dLayer[this.arrLayers.length - 1].deleted = true; 524 dLayer[this.arrLayers.length - 1].deleted = true;
525 ElementMediator.deleteElements(dLayer[this.arrLayers.length - 1].element);
491 this._LayerUndoPosition = this.arrLayers.length - 1; 526 this._LayerUndoPosition = this.arrLayers.length - 1;
492 this._LayerUndoObject = this.arrLayers.pop(); 527 this._LayerUndoObject = this.arrLayers.pop();
493 this._LayerUndoIndex = this._LayerUndoObject.layerID; 528 this._LayerUndoIndex = this._LayerUndoObject.layerID;
@@ -500,7 +535,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
500 535
501 handleElementAdded:{ 536 handleElementAdded:{
502 value:function (event) { 537 value:function (event) {
538
539 this.hashElementMapToLayer.setItem(event.detail.uuid , event.detail,this.currentLayerSelected)
503 this.currentLayerSelected.element.push(event.detail); 540 this.currentLayerSelected.element.push(event.detail);
541
504 } 542 }
505 }, 543 },
506 544
@@ -667,6 +705,35 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
667 return hashLayerNumberObject; 705 return hashLayerNumberObject;
668 } 706 }
669 }, 707 },
708
709 createElementMapToLayer:{
710 value:function(){
711 var hashMappingObject
712 hashMappingObject = Object.create(Object.prototype, {
713 mappingArray:{
714 value:{},
715 writable:true
716 },
717 setItem: {
718 value: function(key,value,layer) {
719 if(this.mappingArray[key]===undefined){
720 this.mappingArray[key]={};
721 }
722 this.mappingArray[key]["element"] = value;
723 this.mappingArray[key].layerID = layer.layerID;
724
725 }
726 },
727
728 getItem: {
729 value: function(key) {
730 return this.mappingArray[key];
731 }
732 }
733 });
734 return hashMappingObject;
735 }
736 },
670 737
671 selectLayer:{ 738 selectLayer:{
672 value:function (layerIndex) { 739 value:function (layerIndex) {
@@ -686,6 +753,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {