aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-02-08 10:29:54 -0800
committerJon Reid2012-02-08 10:29:54 -0800
commitf15310815073203d72de97aa20dbfaa5707ca726 (patch)
treecb98615848765f3ee1d450cbe8b2a581add8ac0d /js
parent687ef6c8c8aad9728f106b1802cf0bfc5ce745f0 (diff)
downloadninja-f15310815073203d72de97aa20dbfaa5707ca726.tar.gz
Timeline: Feature: select first layer by default. Bug fix: Remove left panel blur; we should never have a situation where no layers are selected.
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js47
1 files changed, 13 insertions, 34 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 48537cef..860868e5 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -38,9 +38,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
38 this._layerRepetition = newVal; 38 this._layerRepetition = newVal;
39 } 39 }
40 }, 40 },
41 41 _currentLayerNumber: {
42 value: 0
43 },
42 currentLayerNumber:{ 44 currentLayerNumber:{
43 value:0 45 get: function() {
46 return this._currentLayerNumber;
47 },
48 set: function(newVal) {
49 if (newVal !== this._currentLayerNumber) {
50 this._currentLayerNumber = newVal;
51 }
52 }
44 }, 53 },
45 54
46 millisecondsOffset:{ 55 millisecondsOffset:{
@@ -153,9 +162,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
153 162
154 // New click listener to handle select/deselect events 163 // New click listener to handle select/deselect events
155 this.timeline_leftpane.addEventListener("click", this.timelineLeftPaneClick.bind(this), false); 164 this.timeline_leftpane.addEventListener("click", this.timelineLeftPaneClick.bind(this), false);
156
157 // New click listener on body to handle "blurring" the panel
158 document.addEventListener("click", this.handleBlur.bind(this), false);
159 165
160 // Simultaneous scrolling of the layer and tracks 166 // Simultaneous scrolling of the layer and tracks
161 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false); 167 this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
@@ -170,6 +176,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
170 _firstLayerDraw = false; 176 _firstLayerDraw = false;
171 NJevent('newLayer',this._hashKey); 177 NJevent('newLayer',this._hashKey);
172 _firstLayerDraw = true; 178 _firstLayerDraw = true;
179 this.selectLayer(0);
173 180
174 // TODO - add condition for existing doc and parse DOM for top level elements 181 // TODO - add condition for existing doc and parse DOM for top level elements
175 } 182 }
@@ -256,17 +263,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
256 } 263 }
257 } 264 }
258 }, 265 },
259
260 handleBlur: {
261 value: function(event) {
262 var ptrParent = nj.queryParentSelector(event.target, ".tl_leftpane");
263 if (ptrParent !== false) {
264 // We were clicking somewhere within the left pane, so we shouldn't blur.
265 } else {
266 this.selectLayer("none");
267 }
268 }
269 },
270 266
271 handleNewLayer:{ 267 handleNewLayer:{
272 value:function(event){ 268 value:function(event){
@@ -400,7 +396,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
400 this.layerRepetition.selectedIndexes = [myIndex]; 396 this.layerRepetition.selectedIndexes = [myIndex];
401 */ 397 */
402 398
403 this.selectLayer(myIndex); 399 this.selectLayer(myIndex);
404 400
405 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex); 401 this.hashInstance.setItem(this._hashKey,thingToPush,myIndex);
406 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex); 402 this.hashTrackInstance.setItem(this._hashKey,newTrack,myIndex);
@@ -810,23 +806,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
810 806
811 } 807 }
812 }, 808 },
813 getLayerIndexByName : {
814 value: function(layerName) {
815 // Get the index in this.arrLayers that matches a particular layerName
816 // Returns false if no match
817 var i = 0,
818 returnVal = false,
819 arrLayersLength = this.arrLayers.length;
820
821 for (i=0; i < arrLayersLength; i++) {
822 if (this.arrLayers[i].layerName === layerName) {
823 returnVal = i;
824 }
825 }
826
827 return returnVal;
828 }
829 },
830 809
831 insertLayer: { 810 insertLayer: {
832 value: function() { 811 value: function() {