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.js1098
1 files changed, 685 insertions, 413 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 6e9513f2..f35ce2d3 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -92,12 +92,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
92 this._layerRepetition = newVal; 92 this._layerRepetition = newVal;
93 } 93 }
94 }, 94 },
95
96 _areTracksScrolling: {
97 value: false
98 },
95 99
96 // Set to false to skip array caching array sets in current document 100 // Set to false to skip array caching array sets in currentDocument
97 _boolCacheArrays:{ 101 _boolCacheArrays:{
98 value:true 102 value:true
99 }, 103 },
100 104
105 // Current layer number: iterated and used to assign layer IDs.
101 _currentLayerNumber:{ 106 _currentLayerNumber:{
102 value:0 107 value:0
103 }, 108 },
@@ -126,36 +131,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
126 this.cacheTimeline(); 131 this.cacheTimeline();
127 } 132 }
128 }, 133 },
129 134 _currentElementsSelected: {
130 _selectedLayerID:{ 135 value: []
131 value:false
132 }, 136 },
133 selectedLayerID:{ 137 currentElementsSelected: {
134 get:function () { 138 get: function() {
135 return this._selectedLayerID; 139 return this._currentElementsSelected;
136 }, 140 },
137 set:function (newVal) { 141 set: function(newVal) {
138 if (newVal === false) { 142 this._currentElementsSelected = newVal;
139 // We are clearing the timeline, so just set the value and return. 143 this.cacheTimeline();
140 this._selectedLayerID = newVal; 144 }
141 return;
142 }
143 if (newVal !== this._selectedLayerID) {
144 var selectIndex = this.getLayerIndexByID(newVal);
145 this._selectedLayerID = newVal;
146 this._captureSelection = true;
147 if (this.currentLayerSelected !== false) {
148 this.selectLayer(selectIndex, false);
149 }
150 if (this.currentLayersSelected !== false) {
151 this.selectLayers(this.currentLayersSelected);
152 }
153 if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) {
154 this.selectLayers([]);
155 }
156
157 }
158 }
159 }, 145 },
160 146
161 _currentLayersSelected:{ 147 _currentLayersSelected:{
@@ -171,6 +157,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
171 } 157 }
172 }, 158 },
173 159
160 // The index of the last layer that was clicked on
161 // (used for shift-click multiselect)
162 _lastLayerClicked : {
163 value: 0
164 },
165 lastLayerClicked: {
166 serializable: true,
167 get: function() {
168 return this._lastLayerClicked;
169 },
170 set: function(newVal) {
171 this._lastLayerClicked = newVal
172 }
173 },
174
174 _currentSelectedContainer: { 175 _currentSelectedContainer: {
175 value: null 176 value: null
176 }, 177 },
@@ -220,7 +221,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
220 }, 221 },
221 set:function (val) { 222 set:function (val) {
222 this._masterDuration = val; 223 this._masterDuration = val;
223 this.timebar.style.width = (this._masterDuration / 12) + "px"; 224 var intDur = Math.round(val/12),
225 strWidth = intDur + "px";
226 this.timebar.style.width = strWidth;
224 } 227 }
225 }, 228 },
226 229
@@ -280,10 +283,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
280 } 283 }
281 }, 284 },
282 285
283 _isLayer:{
284 value:false
285 },
286
287 _firstTimeLoaded:{ 286 _firstTimeLoaded:{
288 value:true 287 value:true
289 }, 288 },
@@ -299,6 +298,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
299 timeMarkerHolder:{ 298 timeMarkerHolder:{
300 value:null 299 value:null
301 }, 300 },
301
302 // Drag and Drop properties
302 _dragAndDropHelper : { 303 _dragAndDropHelper : {
303 value: false 304 value: false
304 }, 305 },
@@ -311,6 +312,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
311 _dragLayerID : { 312 _dragLayerID : {
312 value: null 313 value: null
313 }, 314 },
315 _draggingType: {
316 value: false
317 },
318 draggingType: {
319 get: function() {
320 return this._draggingType;
321 },
322 set: function(newVal) {
323 this._draggingType = newVal;
324 }
325 },
314 326
315 layersDragged:{ 327 layersDragged:{
316 value:[], 328 value:[],
@@ -327,6 +339,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
327 } 339 }
328 } 340 }
329 }, 341 },
342 _dragLayerIndexes: {
343 value: []
344 },
330 _dropLayerID : { 345 _dropLayerID : {
331 value: null 346 value: null
332 }, 347 },
@@ -338,20 +353,32 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
338 if (newVal !== this._dropLayerID) { 353 if (newVal !== this._dropLayerID) {
339 this._dropLayerID = newVal; 354 this._dropLayerID = newVal;
340 355
341 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), 356 var dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
342 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), 357 arrDragLayers = [],
343 dragLayer = this.arrLayers[dragLayerIndex]; 358 i = 0,
344 this.layersDragged.push(dragLayer); 359 dragLayerIndexesLength = this._dragLayerIndexes.length;
345 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex]; 360
346 361 // TODO: possibly we'll need to sort dragLayerIndexes so things don't get out of order?
347 this.arrLayers.splice(dragLayerIndex, 1); 362
348 this.arrLayers.splice(dropLayerIndex, 0, dragLayer); 363 for (i = 0; i < dragLayerIndexesLength; i++) {
364 var myDraggingLayer = this.arrLayers[this._dragLayerIndexes[i]];
365 arrDragLayers.push(myDraggingLayer);
366 // Splice arrLayers
367 this.arrLayers.splice(this._dragLayerIndexes[i], 1);
368 this.arrLayers.splice(dropLayerIndex, 0, myDraggingLayer);
369 }
370 this.layersDragged = arrDragLayers;
371 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex];
372
373 // Cache the new info
349 this.cacheTimeline(); 374 this.cacheTimeline();
350 375
351 // Clear for future DnD 376 // Clear drag and drop variables for future re-use
352 this._dropLayerID = null; 377 this._dropLayerID = null;
353 this._dragLayerID = null; 378 this.dragLayerIndexes = [];
354 379 this._dragLayerIndexes = [];
380 this.lastLayerClicked = 0;
381
355 // Sometimes, just to be fun, the drop and dragend events don't fire. 382 // Sometimes, just to be fun, the drop and dragend events don't fire.
356 // So just in case, set the draw routine to delete the helper. 383 // So just in case, set the draw routine to delete the helper.
357 this._deleteHelper = true; 384 this._deleteHelper = true;
@@ -368,10 +395,41 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
368 _scrollTracks: { 395 _scrollTracks: {
369 value: false 396 value: false