aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorJon Reid2012-04-05 13:40:14 -0700
committerJon Reid2012-04-05 13:40:14 -0700
commita8ea8f377919c7f1a6af69311f55fd57727d9058 (patch)
tree460a2a54613159285cc0a9985bc6aaa4e40a5416 /js/panels
parenta36266b640207b3a95aaa145def263a469ecee15 (diff)
downloadninja-a8ea8f377919c7f1a6af69311f55fd57727d9058.tar.gz
Timeline: Improved drag-and-drop performance. Also fix problems with
expand/collapse getting out of synch during drag-and-drop.
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js28
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js22
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js26
3 files changed, 36 insertions, 40 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index b8ab1539..3bcc1401 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -311,11 +311,9 @@ var Layer = exports.Layer = Montage.create(Component, {
311 return this._isMainCollapsed; 311 return this._isMainCollapsed;
312 }, 312 },
313 set: function(newVal) { 313 set: function(newVal) {
314 if (newVal !== this._isMainCollapsed) { 314 this._isMainCollapsed = newVal;
315 this.log('layer.js: isMainCollapsed: ' + newVal); 315 this.layerData.isMainCollapsed = newVal;
316 this._isMainCollapsed = newVal; 316
317 this.layerData.isMainCollapsed = newVal;
318 }
319 } 317 }
320 }, 318 },
321 319
@@ -329,10 +327,8 @@ var Layer = exports.Layer = Montage.create(Component, {
329 return this._isTransformCollapsed; 327 return this._isTransformCollapsed;
330 }, 328 },
331 set: function(newVal) { 329 set: function(newVal) {
332 if (newVal !== this._isTransformCollapsed) { 330 this._isTransformCollapsed = newVal;
333 this._isTransformCollapsed = newVal; 331 this.layerData.isTransformCollapsed = newVal;
334 this.layerData.isTransformCollapsed = newVal;
335 }
336 } 332 }
337 }, 333 },
338 334
@@ -346,10 +342,8 @@ var Layer = exports.Layer = Montage.create(Component, {
346 return this._isPositionCollapsed; 342 return this._isPositionCollapsed;
347 }, 343 },
348 set: function(newVal) { 344 set: function(newVal) {
349 if (newVal !== this._isPositionCollapsed) { 345 this._isPositionCollapsed = newVal;
350 this._isPositionCollapsed = newVal; 346 this.layerData.isPositionCollapsed = newVal;
351 this.layerData.isPositionCollapsed = newVal;
352 }
353 } 347 }
354 }, 348 },
355 349
@@ -363,10 +357,8 @@ var Layer = exports.Layer = Montage.create(Component, {
363 return this._isStyleCollapsed; 357 return this._isStyleCollapsed;
364 }, 358 },
365 set: function(newVal) { 359 set: function(newVal) {
366 if (newVal !== this._isStyleCollapsed) { 360 this._isStyleCollapsed = newVal;
367 this._isStyleCollapsed = newVal; 361 this.layerData.isStyleCollapsed = newVal;
368 this.layerData.isStyleCollapsed = newVal;
369 }
370 } 362 }
371 }, 363 },
372 _bypassAnimation : { 364 _bypassAnimation : {
@@ -379,7 +371,7 @@ var Layer = exports.Layer = Montage.create(Component, {
379 return this._bypassAnimation; 371 return this._bypassAnimation;
380 }, 372 },
381 set: function(newVal) { 373 set: function(newVal) {
382 if ((newVal !== this._bypassAnimation) && (typeof(this.layerData) !== "undefined")) { 374 if (typeof(this.layerData) !== "undefined") {
383 this._bypassAnimation = newVal; 375 this._bypassAnimation = newVal;
384 this.layerData.bypassAnimation = newVal; 376 this.layerData.bypassAnimation = newVal;
385 } 377 }
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 647d2f4e..2df447db 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -294,12 +294,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
294 if (newVal !== this._dropLayerID) { 294 if (newVal !== this._dropLayerID) {
295 this._dropLayerID = newVal; 295 this._dropLayerID = newVal;
296 296
297 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), 297 var myNewArray = [],
298 dragLayerIndex = this.getLayerIndexByID(this.dragLayerID),
298 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), 299 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
299 dragLayer = this.arrLayers[dragLayerIndex]; 300 dragLayer = myNewArray[dragLayerIndex],
301 thing;
302
303 // Copy arrLayers into new array; we want to avoid referencing.
304 for (thing in this.arrLayers) {
305 myNewArray[thing] = this.arrLayers[thing];
306 }
300 307
301 this.arrLayers.splice(dragLayerIndex, 1); 308 // Operate on new array
302 this.arrLayers.splice(dropLayerIndex, 0, dragLayer); 309 myNewArray.splice(dragLayerIndex, 1);
310 myNewArray.splice(dropLayerIndex, 0, dragLayer);
311
312 // Feed new array into repetition
313 this.arrLayers = myNewArray;
314 // Store reference in currentDocument.
303 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 315 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
304 316
305 // Clear for future DnD 317 // Clear for future DnD
@@ -307,7 +319,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
307 this._dragLayerID = null; 319 this._dragLayerID = null;
308 320
309 // Sometimes, just to be fun, the drop and dragend events don't fire. 321 // Sometimes, just to be fun, the drop and dragend events don't fire.
310 // So just in case, set the draw routine to delete the helper. 322 // To avoid this, set the draw routine to delete the helper here.
311 this._deleteHelper = true; 323 this._deleteHelper = true;
312 this.needsDraw = true; 324 this.needsDraw = true;
313 } 325 }
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index edca4306..8b639758 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -42,10 +42,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
42 return this._isMainCollapsed; 42 return this._isMainCollapsed;
43 }, 43 },
44 set:function (newVal) { 44 set:function (newVal) {
45 if (newVal !== this._isMainCollapsed) { 45 this._isMainCollapsed = newVal;
46 this._isMainCollapsed = newVal; 46 this.trackData.isMainCollapsed = newVal;
47 this.trackData.isMainCollapsed = newVal;
48 }
49 } 47 }
50 }, 48 },
51 _isTransformCollapsed:{ 49 _isTransformCollapsed:{
@@ -56,10 +54,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
56 return this._isTransformCollapsed; 54 return this._isTransformCollapsed;
57 }, 55 },
58 set:function (newVal) { 56 set:function (newVal) {
59 if (newVal !== this._isTransformCollapsed) { 57 this._isTransformCollapsed = newVal;
60 this._isTransformCollapsed = newVal; 58 this.trackData.isTransformCollapsed = newVal;
61 this.trackData.isTransformCollapsed = newVal;
62 }
63 } 59 }
64 }, 60 },
65 _isPositionCollapsed:{ 61 _isPositionCollapsed:{
@@ -70,10 +66,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
70 return this._isPositionCollapsed; 66 return this._isPositionCollapsed;
71 }, 67 },
72 set:function (newVal) { 68 set:function (newVal) {
73 if (newVal !== this._isPositionCollapsed) { 69 this._isPositionCollapsed = newVal;
74 this._isPositionCollapsed = newVal; 70 this.trackData.isPositionCollapsed = newVal;
75 this.trackData.isPositionCollapsed = newVal;
76 }
77 } 71 }
78 }, 72 },
79 _isStyleCollapsed:{ 73 _isStyleCollapsed:{
@@ -84,10 +78,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
84 return this._isStyleCollapsed; 78 return this._isStyleCollapsed;
85 }, 79 },
86 set:function (newVal) { 80 set:function (newVal) {
87 if (newVal !== this._isStyleCollapsed) { 81 this._isStyleCollapsed = newVal;
88 this._isStyleCollapsed = newVal; 82 this.trackData.isStyleCollapsed = newVal;
89 this.trackData.isStyleCollapsed = newVal;
90 }
91 } 83 }
92 }, 84 },
93 _bypassAnimation : { 85 _bypassAnimation : {
@@ -100,7 +92,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
100 return this._bypassAnimation; 92 return this._bypassAnimation;
101 }, 93 },
102 set: function(newVal) { 94 set: function(newVal) {
103 if ((newVal !== this._bypassAnimation) && (typeof(this.trackData) !== "undefined")) { 95 if (typeof(this.trackData) !== "undefined") {
104 this._bypassAnimation = newVal; 96 this._bypassAnimation = newVal;
105 this.trackData.bypassAnimation = newVal; 97 this.trackData.bypassAnimation = newVal;
106 } 98 }