From f9891da6d6c6940f218cdc6d1e71e1c027852f48 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 16 Mar 2012 12:54:16 -0700 Subject: Fix layer select on selection change Signed-off-by: Jonathan Duran --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 528d1fbf..3e82a760 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -557,16 +557,25 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if(this.application.ninja.selectedElements[0]){ - // TODO - element uuid should be stored directly in layer array (possibly as the layerID) - key = this.application.ninja.selectedElements[0].uuid; - - switchSelectedLayer = this.hashElementMapToLayer.getItem(key); - if(switchSelectedLayer!==undefined){ - layerIndex = this.getLayerIndexByID(switchSelectedLayer.layerID); - this._captureSelection=false; - this.selectLayer(layerIndex); - this._captureSelection=true; + for (var i = 0; i < this.arrLayers.length; i++) { + if (this.application.ninja.selectedElements[0].uuid === this.arrLayers[i].layerData.elementsList[0].uuid) { + layerIndex = this.getLayerIndexByID(this.arrLayers[i].layerData.layerID); + this._captureSelection = false; + this.selectLayer(layerIndex); + this._captureSelection = true; + } } + +// // TODO - element uuid should be stored directly in layer array (possibly as the layerID) +// key = this.application.ninja.selectedElements[0].uuid; +// +// switchSelectedLayer = this.hashElementMapToLayer.getItem(key); +// if(switchSelectedLayer!==undefined){ +// layerIndex = this.getLayerIndexByID(switchSelectedLayer.layerID); +// this._captureSelection=false; +// this.selectLayer(layerIndex); +// this._captureSelection=true; +// } } } }, @@ -870,7 +879,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleElementAdded:{ value:function (event) { this.insertLayer(); - console.log("inserting layer"); + //console.log("inserting layer"); this.addElementToLayer(this.application.ninja.selectedElements[0]); } @@ -880,9 +889,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { value:function (element) { - console.log("setting element to layer"); - console.log(element); - console.log(this.currentLayerSelected.layerData); + //console.log("setting element to layer"); + //console.log(element); + //console.log(this.currentLayerSelected.layerData); //element.uuid = nj.generateRandom(); -- cgit v1.2.3