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.js22
1 files changed, 5 insertions, 17 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index f218868a..eabe1a7a 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -294,24 +294,12 @@ 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 myNewArray = [], 297 var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID),
298 dragLayerIndex = this.getLayerIndexByID(this.dragLayerID),
299 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), 298 dropLayerIndex = this.getLayerIndexByID(this.dropLayerID),
300 dragLayer = myNewArray[dragLayerIndex], 299 dragLayer = this.arrLayers[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 }
307 300
308 // Operate on new array 301 this.arrLayers.splice(dragLayerIndex, 1);
309 myNewArray.splice(dragLayerIndex, 1); 302 this.arrLayers.splice(dropLayerIndex, 0, dragLayer);
310 myNewArray.splice(dropLayerIndex, 0, dragLayer);
311
312 // Feed new array into repetition
313 this.arrLayers = myNewArray;
314 // Store reference in currentDocument.
315 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; 303 this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
316 304
317 // Clear for future DnD 305 // Clear for future DnD
@@ -319,7 +307,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
319 this._dragLayerID = null; 307 this._dragLayerID = null;
320 308
321 // Sometimes, just to be fun, the drop and dragend events don't fire. 309 // Sometimes, just to be fun, the drop and dragend events don't fire.
322 // To avoid this, set the draw routine to delete the helper here. 310 // So just in case, set the draw routine to delete the helper.
323 this._deleteHelper = true; 311 this._deleteHelper = true;
324 this.needsDraw = true; 312 this.needsDraw = true;
325 } 313 }