From bd4c9a4630f5de3571e68b8779dc1b6604095781 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Tue, 10 Apr 2012 16:37:00 -0700 Subject: Timeline: Bug fix: Drag and Drop now working again. --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'js/panels') 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, { if (newVal !== this._dropLayerID) { this._dropLayerID = newVal; - var myNewArray = [], - dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), + var dragLayerIndex = this.getLayerIndexByID(this.dragLayerID), dropLayerIndex = this.getLayerIndexByID(this.dropLayerID), - dragLayer = myNewArray[dragLayerIndex], - thing; - - // Copy arrLayers into new array; we want to avoid referencing. - for (thing in this.arrLayers) { - myNewArray[thing] = this.arrLayers[thing]; - } + dragLayer = this.arrLayers[dragLayerIndex]; - // Operate on new array - myNewArray.splice(dragLayerIndex, 1); - myNewArray.splice(dropLayerIndex, 0, dragLayer); - - // Feed new array into repetition - this.arrLayers = myNewArray; - // Store reference in currentDocument. + this.arrLayers.splice(dragLayerIndex, 1); + this.arrLayers.splice(dropLayerIndex, 0, dragLayer); this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; // Clear for future DnD @@ -319,7 +307,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._dragLayerID = null; // Sometimes, just to be fun, the drop and dragend events don't fire. - // To avoid this, set the draw routine to delete the helper here. + // So just in case, set the draw routine to delete the helper. this._deleteHelper = true; this.needsDraw = true; } -- cgit v1.2.3