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, 17 insertions, 5 deletions
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 }