aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-04-10 16:37:00 -0700
committerJon Reid2012-04-10 16:37:00 -0700
commitbd4c9a4630f5de3571e68b8779dc1b6604095781 (patch)
treed96fe453f5279e4ecf041d4a59741d2c1a2bd674 /js
parentc19987997758cf47ac9b93a2a767a0e2a9072745 (diff)
downloadninja-bd4c9a4630f5de3571e68b8779dc1b6604095781.tar.gz
Timeline: Bug fix: Drag and Drop now working again.
Diffstat (limited to '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 }