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.js1139
1 files changed, 692 insertions, 447 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index d1cab096..185211ae 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -57,12 +57,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
57 this._layerRepetition = newVal; 57 this._layerRepetition = newVal;
58 } 58 }
59 }, 59 },
60
61 _areTracksScrolling: {
62 value: false
63 },
60 64
61 // Set to false to skip array caching array sets in current document 65 // Set to false to skip array caching array sets in currentDocument
62 _boolCacheArrays:{ 66 _boolCacheArrays:{
63 value:true 67 value:true
64 }, 68 },
65 69
70 // Current layer number: iterated and used to assign layer IDs.
66 _currentLayerNumber:{ 71 _currentLayerNumber:{
67 value:0 72 value:0
68 }, 73 },
@@ -91,36 +96,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
91 this.cacheTimeline(); 96 this.cacheTimeline();
92 } 97 }
93 }, 98 },
94 99 _currentElementsSelected: {
95 _selectedLayerID:{ 100 value: []
96 value:false
97 }, 101 },
98 selectedLayerID:{ 102 currentElementsSelected: {
99 get:function () { 103 get: function() {
100 return this._selectedLayerID; 104 return this._currentElementsSelected;
101 }, 105 },
102 set:function (newVal) { 106 set: function(newVal) {
103 if (newVal === false) { 107 this._currentElementsSelected = newVal;
104 // We are clearing the timeline, so just set the value and return. 108 this.cacheTimeline();
105 this._selectedLayerID = newVal; 109 }
106 return;
107 }
108 if (newVal !== this._selectedLayerID) {
109 var selectIndex = this.getLayerIndexByID(newVal);
110 this._selectedLayerID = newVal;
111 this._captureSelection = true;
112 if (this.currentLayerSelected !== false) {
113 this.selectLayer(selectIndex, true);
114 }
115 if (this.currentLayersSelected !== false) {
116 this.selectLayers(this.currentLayersSelected);
117 }
118 if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) {
119 this.selectLayers([]);
120 }
121
122 }
123 }
124 }, 110 },
125 111
126 _currentLayersSelected:{ 112 _currentLayersSelected:{
@@ -136,6 +122,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
136 } 122 }
137 }, 123 },
138 124
125 // The index of the last layer that was clicked on
126 // (used for shift-click multiselect)
127 _lastLayerClicked : {
128 value: 0
129 },
130 lastLayerClicked: {
131 serializable: true,
132 get: function() {
133 return this._lastLayerClicked;
134 },
135 set: function(newVal) {
136 this._lastLayerClicked = newVal
137 }
138 },
139
139 _currentSelectedContainer: { 140 _currentSelectedContainer: {
140 value: null 141 value: null
141 }, 142 },
@@ -177,7 +178,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
177 }, 178 },
178 set:function (val) { 179 set:function (val) {
179 this._masterDuration = val; 180 this._masterDuration = val;
180 this.timebar.style.width = (this._masterDuration / 12) + "px"; 181 var intDur = Math.round(val/12),
182 strWidth = intDur + "px";
183 this.timebar.style.width = strWidth;
181 } 184 }
182 }, 185 },
183 186
@@ -233,15 +236,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
233 set:function (value) { 236 set:function (value) {
234 if (this._breadCrumbContainer !== value) { 237 if (this._breadCrumbContainer !== value) {
235 this._breadCrumbContainer = value; 238 this._breadCrumbContainer = value;
236 //this.LayerBinding();
237 } 239 }
238 } 240 }
239 }, 241 },
240 242
241 _isLayer:{
242 value:false
243 },
244
245 _firstTimeLoaded:{ 243 _firstTimeLoaded:{
246 value:true 244 value:true
247 }, 245 },
@@ -257,6 +255,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
257 timeMarkerHolder:{ 255 timeMarkerHolder:{
258 value:null 256 value:null
259 }, 257 },
258
259 // Drag and Drop properties
260 _dragAndDropHelper : { 260 _dragAndDropHelper : {
261 value: false 261 value: false
262 }, 262 },
@@ -269,6 +269,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
269 _dragLayerID : { 269 _dragLayerID : {
270 value: null 270 value: null
271 }, 271 },
272 _draggingType: {
273 value: false
274 },
275 draggingType: {
276 get: function() {
277 return this._draggingType;
278 },
279 set: function(newVal) {
280 this._draggingType = newVal;
281 }
282 },
272 283
273 layersDragged:{ 284 layersDragged:{
274 value:[], 285 value:[],
@@ -285,6 +296,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
285 } 296 }
286 } 297 }
287 }, 298 },
299 _dragLayerIndexes: {
300 value: []
301 },
288 _dropLayerID : { 302 _dropLayerID : {
289 value: null 303 value: null
290 }, 304 },
@@ -296,20 +310,32 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
296 if (newVal !== this._dropLayerID) { 310 if (newVal !== this._dropLayerID) {
297 this._dropLayerID = newVal; 311 this._dropLayerID = newVal;
298 312
299 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), 313 var dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
300 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), 314 arrDragLayers = [],
301 dragLayer = this.arrLayers[dragLayerIndex]; 315 i = 0,
302 this.layersDragged.push(dragLayer); 316 dragLayerIndexesLength = this._dragLayerIndexes.length;
303 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex]; 317
304 318 // TODO: possibly we'll need to sort dragLayerIndexes so things don't get out of order?
305 this.arrLayers.splice(dragLayerIndex, 1); 319
306 this.arrLayers.splice(dropLayerIndex, 0, dragLayer); 320 for (i = 0; i < dragLayerIndexesLength; i++) {
321 var myDraggingLayer = this.arrLayers[this._dragLayerIndexes[i]];
322 arrDragLayers.push(myDraggingLayer);
323 // Splice arrLayers
324 this.arrLayers.splice(this._dragLayerIndexes[i], 1);
325 this.arrLayers.splice(dropLayerIndex, 0, myDraggingLayer);
326 }
327 this.layersDragged = arrDragLayers;
328 this._layerDroppedInPlace = this.arrLayers[dropLayerIndex];
329
330 // Cache the new info
307 this.cacheTimeline(); 331 this.cacheTimeline();
308 332
309 // Clear for future DnD 333 // Clear drag and drop variables for future re-use
310 this._dropLayerID = null; 334 this._dropLayerID = null;
311 this._dragLayerID = null; 335 this.dragLayerIndexes = [];
312 336 this._dragLayerIndexes = [];
337 this.lastLayerClicked = 0;
338
313 // Sometimes, just to be fun, th