aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelinePanel.reel
diff options
context:
space:
mode:
authorJon Reid2012-05-17 18:14:17 -0700
committerJon Reid2012-05-17 18:14:17 -0700
commitef499e92341c9bd6edbee70f86dc5a6fe8b461eb (patch)
treef808a1657c9247c5e7d92ccfdc64e1d7f61337ae /js/panels/Timeline/TimelinePanel.reel
parentd3e2e8c0e4be6a324eac3a3ea050b4c41183f79b (diff)
downloadninja-ef499e92341c9bd6edbee70f86dc5a6fe8b461eb.tar.gz
Timeline: More bug fixes and code cleanup for multiselect.
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js340
1 files changed, 10 insertions, 330 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index ce8174b0..d1f51d16 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -108,37 +108,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
108 } 108 }
109 }, 109 },
110 110
111 _selectedLayerID:{
112 value:false
113 },
114 selectedLayerID:{
115 get:function () {
116 return this._selectedLayerID;
117 },
118 set:function (newVal) {
119 if (newVal === false) {
120 // We are clearing the timeline, so just set the value and return.
121 this._selectedLayerID = newVal;
122 return;
123 }
124 if (newVal !== this._selectedLayerID) {
125 var selectIndex = this.getLayerIndexByID(newVal);
126 this._selectedLayerID = newVal;
127 this._captureSelection = true;
128 if (this.currentLayerSelected !== false) {
129 this.selectLayer(selectIndex, true);
130 }
131 if (this.currentLayersSelected !== false) {
132 this.selectLayers(this.currentLayersSelected);
133 }
134 if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) {
135 this.selectLayers([]);
136 }
137
138 }
139 }
140 },
141
142 _currentLayersSelected:{ 111 _currentLayersSelected:{
143 value:[] 112 value:[]
144 }, 113 },
@@ -151,6 +120,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
151 this.cacheTimeline(); 120 this.cacheTimeline();
152 } 121 }
153 }, 122 },
123
154 // The index of the last layer that was clicked on 124 // The index of the last layer that was clicked on
155 // (used for shift-click multiselect) 125 // (used for shift-click multiselect)
156 _lastLayerClicked : { 126 _lastLayerClicked : {
@@ -265,7 +235,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
265 set:function (value) { 235 set:function (value) {
266 if (this._breadCrumbContainer !== value) { 236 if (this._breadCrumbContainer !== value) {
267 this._breadCrumbContainer = value; 237 this._breadCrumbContainer = value;
268 //this.LayerBinding();
269 } 238 }
270 } 239 }
271 }, 240 },
@@ -350,17 +319,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
350 for (i = 0; i < dragLayerIndexesLength; i++) { 319 for (i = 0; i < dragLayerIndexesLength; i++) {
351 var myDraggingLayer = this.arrLayers[this._dragLayerIndexes[i]]; 320 var myDraggingLayer = this.arrLayers[this._dragLayerIndexes[i]];
352 arrDragLayers.push(myDraggingLayer); 321 arrDragLayers.push(myDraggingLayer);
322 // Splice arrLayers
353 this.arrLayers.splice(this._dragLayerIndexes[i], 1); 323 this.arrLayers.splice(this._dragLayerIndexes[i], 1);
354 this.arrLayers.splice(dropLayerIndex, 0, myDraggingLayer); 324 this.arrLayers.splice(dropLayerIndex, 0, myDraggingLayer);
355 } 325 }
356 console.log(arrDragLayers);
357 //this.arrLayers.splice(dropLayerIndex, 0, arrDragLayers);
358 this.layersDragged = arrDragLayers; 326 this.layersDragged = arrDragLayers;
359 console.log(this.layersDragged);
360 console.log(this.arrLayers);
361 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex]; 327 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex];
328
329 // Cache the new info
362 this.cacheTimeline(); 330 this.cacheTimeline();
363 331
332 // Clear drag and drop variables for future re-use
364 this._dropLayerID = null; 333 this._dropLayerID = null;
365 this.dragLayerIndexes = []; 334 this.dragLayerIndexes = [];
366 this._dragLayerIndexes = []; 335 this._dragLayerIndexes = [];
@@ -370,27 +339,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
370 // So just in case, set the draw routine to delete the helper. 339 // So just in case, set the draw routine to delete the helper.
371 this._deleteHelper = true; 340 this._deleteHelper = true;
372 this.needsDraw = true; 341 this.needsDraw = true;
373
374/*
375 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID),
376 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
377 dragLayer = this.arrLayers[dragLayerIndex];
378 this.layersDragged.push(dragLayer);
379 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex];
380
381 this.arrLayers.splice(dragLayerIndex, 1);
382 this.arrLayers.splice(dropLayerIndex, 0, dragLayer);
383 this.cacheTimeline();
384
385 // Clear for future DnD
386 this._dropLayerID = null;
387 this._dragLayerID = null;
388
389 // Sometimes, just to be fun, the drop and dragend events don't fire.
390 // So just in case, set the draw routine to delete the helper.
391 this._deleteHelper = true;
392 this.needsDraw = true;
393*/
394 } 342 }
395 } 343 }
396 }, 344 },
@@ -428,6 +376,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
428 value: false 376 value: false
429 }, 377 },
430 /* === END: Models === */ 378 /* === END: Models === */
379
431 /* === BEGIN: Draw cycle === */ 380 /* === BEGIN: Draw cycle === */
432 prepareForDraw:{ 381 prepareForDraw:{
433 value:function () { 382 value:function () {
@@ -780,14 +729,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
780 this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected; 729 this.currentLayersSelected = this.application.ninja.currentDocument.tlCurrentLayersSelected;
781 this.currentElementsSelected = this.application.ninja.currentDocument.tlCurrentElementsSelected; 730 this.currentElementsSelected = this.application.ninja.currentDocument.tlCurrentElementsSelected;
782 this._currentDocumentUuid = this.application.ninja.currentDocument.uuid; 731 this._currentDocumentUuid = this.application.ninja.currentDocument.uuid;
783
784
785 //debugger;
786 if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") {
787// this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer;
788 }
789
790 // TODO: select elements stored in currentElementsSelected.
791 732
792 // Are we only showing animated layers? 733 // Are we only showing animated layers?
793 if (this.application.ninja.currentDocument.boolShowOnlyAnimated) { 734 if (this.application.ninja.currentDocument.boolShowOnlyAnimated) {
@@ -816,7 +757,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
816 this.deselectTweens(); 757 this.deselectTweens();
817 758
818 // Reset visual appearance 759 // Reset visual appearance
819 // Todo: Maybe this should be stored per document, so we can persist between document switch? 760 // TODO: Maybe playhead position should be stored per document, so we can persist between document switch?
820 this.application.ninja.timeline.playhead.style.left = "-2px"; 761 this.application.ninja.timeline.playhead.style.left = "-2px";
821 this.application.ninja.timeline.playheadmarker.style.left = "0px"; 762 this.application.ninja.timeline.playheadmarker.style.left = "0px";
822 this.application.ninja.timeline.updateTimeText(0.00); 763 this.application.ninja.timeline.updateTimeText(0.00);
@@ -876,20 +817,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
876 } 817 }
877 }, 818 },
878 819
879 LayerBinding:{
880 value:function (node) {
881 var i = 0;
882
883 if(this._firstTimeLoaded){
884 this._firstTimeLoaded = false;
885 return;
886 }
887
888 this.handleDocumentChange(node);
889 }
890 },
891
892
893 updateTrackContainerWidth:{ 820 updateTrackContainerWidth:{
894 value:function () { 821 value:function () {
895 this.container_tracks.style.width = (this.end_hottext.value * 80) + "px"; 822 this.container_tracks.style.width = (this.end_hottext.value * 80) + "px";
@@ -936,48 +863,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
936 handleSelectionChange: { 863 handleSelectionChange: {
937 value:function (event) { 864 value:function (event) {
938 this.updateLayerSelection(); 865 this.updateLayerSelection();
939 /*
940 var layerIndex,
941 i = 0,
942 j = 0,
943 arrLayersLength = this.arrLayers.length,
944 intNumSelected = event.detail.elements.length,
945 checkIndex = 0;
946
947 //console.log("TimelinePanel.handleSelectionChange, intNumSelected is ", intNumSelected)
948
949 if (intNumSelected === 0) {
950 if (this._ignoreSelectionChanges !== true) {
951 this.selectLayers([]);