aboutsummaryrefslogtreecommitdiff
path: root/js/panels
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
parentd3e2e8c0e4be6a324eac3a3ea050b4c41183f79b (diff)
downloadninja-ef499e92341c9bd6edbee70f86dc5a6fe8b461eb.tar.gz
Timeline: More bug fixes and code cleanup for multiselect.
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js12
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js340
2 files changed, 10 insertions, 342 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index 4a737490..48b2dfdf 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -524,14 +524,6 @@ var Layer = exports.Layer = Montage.create(Component, {
524 value: function() { 524 value: function() {
525 // console.log("Layer.didDraw: Layer "+ this.layerID ); 525 // console.log("Layer.didDraw: Layer "+ this.layerID );
526 if (this._isFirstDraw === true) { 526 if (this._isFirstDraw === true) {
527 if (this.isSelected === true) {
528 if (this.application.ninja.currentDocument._uuid === this._docUUID) {
529 // Once we're done drawing the first time we need to tell the TimelinePanel if
530 // this layer is supposed to be selected.
531 //console.log('layerName ' + this.layerName);
532 this.parentComponent.parentComponent.selectedLayerID = this.layerID;
533 }
534 }
535 this._isFirstDraw = false; 527 this._isFirstDraw = false;
536 this.layerData._isFirstDraw = false; 528 this.layerData._isFirstDraw = false;
537 529
@@ -539,7 +531,6 @@ var Layer = exports.Layer = Montage.create(Component, {
539 this.mainCollapser.myContent.style.height = "auto"; 531 this.mainCollapser.myContent.style.height = "auto";
540 this.mainCollapser.myContent.classList.remove(this.mainCollapser.collapsedClass); 532 this.mainCollapser.myContent.classList.remove(this.mainCollapser.collapsedClass);
541 this.mainCollapser.clicker.classList.remove(this.mainCollapser.collapsedClass); 533 this.mainCollapser.clicker.classList.remove(this.mainCollapser.collapsedClass);
542
543 } 534 }
544 if (this.isPositionCollapsed === false) { 535 if (this.isPositionCollapsed === false) {
545 this.positionCollapser.myContent.style.height = "auto"; 536 this.positionCollapser.myContent.style.height = "auto";
@@ -553,9 +544,6 @@ var Layer = exports.Layer = Montage.create(Component, {
553 } 544 }
554 545
555 } 546 }
556
557
558
559 } 547 }
560 }, 548 },
561 /* End: Draw cycle */ 549 /* End: Draw cycle */
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";