From 205d869d94005cb214fd838879d4f5e81d763311 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 1 Mar 2012 18:01:08 -0800 Subject: Timeline: Merge arrlayers and arrtracks into one object. Redefine collapser to use property binding instead of events. --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 43 ++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 59306705..49f044d7 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -47,11 +47,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { _cacheArrays : { value: function() { // Cache this.arrLayers and this.arrTracks. - this.log('cacheArrays ' + this._boolCacheArrays) + //this.log('cacheArrays ' + this._boolCacheArrays) if (this._boolCacheArrays) { - this.log('caching arrays for ', this.application.ninja.currentDocument.name); + //this.log('caching arrays for ', this.application.ninja.currentDocument.name); this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; - this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; + //this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; } } }, @@ -530,6 +530,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (layerResult = this.returnedObject[hashIndex]) { trackResult = this.returnedTrack[hashIndex]; if (layerResult.deleted !== true) { + + // TODO: Help from Kruti this.arrTracks.push(trackResult); this.arrLayers.push(layerResult); @@ -545,6 +547,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (dLayer[hashVariable]) { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; + + // TODO: Help from Kruti this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); @@ -572,6 +576,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (dLayer[hashVariable]) { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; + + // TODO: Help from Kruti this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); @@ -608,6 +614,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.deleted = false; thingToPush.isSelected = false; thingToPush.created=false; + thingToPush.isTrackAnimated = false; + thingToPush.currentKeyframeRule = null; + thingToPush.trackPosition = 0; + thingToPush.arrStyleTracks = []; + thingToPush.tweens = []; if (_firstLayerDraw) { this.application.ninja.currentSelectedContainer.uuid=this._hashKey; @@ -619,7 +630,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { event.detail.ele.uuid =nj.generateRandom(); thingToPush.elementsList.push(event.detail.ele); } - + /* newTrack.trackID = this.currentLayerNumber; newTrack.isMainCollapsed = true; newTrack.isPositionCollapsed = true; @@ -630,6 +641,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { newTrack.trackPosition = 0; newTrack.arrStyleTracks = []; newTrack.tweens = []; + */ if (_firstLayerDraw) { if (this.application.ninja.currentSelectedContainer.id === "UserContent") { @@ -643,18 +655,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { myIndex = this.layerRepetition.selectedIndexes[0]; thingToPush.layerPosition = myIndex; thingToPush.isSelected = true; - newTrack.trackPosition = myIndex; - this.arrTracks.splice(myIndex, 0, newTrack); + //newTrack.trackPosition = myIndex; + thingToPush.trackPosition = myIndex; + //this.arrTracks.splice(myIndex, 0, newTrack); this.arrLayers.splice(myIndex, 0, thingToPush); this._LayerUndoPosition = myIndex; this.selectLayer(myIndex); this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); + + // TODO: Help from Kruti this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); } else { - this.arrTracks.splice(0, 0, newTrack); + //this.arrTracks.splice(0, 0, newTrack); this.arrLayers.splice(0, 0, thingToPush); thingToPush.layerPosition = this.arrLayers.length - 1; + + // TODO: Help from Kruti newTrack.trackPosition = this.arrTracks.length - 1; this._LayerUndoPosition = this.arrLayers.length - 1; this.hashLayerNumber.setItem(this._hashKey, thingToPush); @@ -697,7 +714,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[hashVariable].deleted = true; // ElementMediator.deleteElements(dLayer[myIndex].element); this.arrLayers.splice(k, 1); - this.arrTracks.splice(k, 1); + //this.arrTracks.splice(k, 1); if(k>0){ this.selectLayer(k-1); }else{ @@ -735,7 +752,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[hashVariable].deleted = true; // ElementMediator.deleteElements(dLayer[myIndex].element); this.arrLayers.splice(k, 1); - this.arrTracks.splice(k, 1); + //this.arrTracks.splice(k, 1); if(k>0){ this.selectLayer(k-1); }else{ @@ -754,6 +771,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (!!this.layerRepetition.selectedIndexes) { var myIndex = this.layerRepetition.selectedIndexes[0]; this._LayerUndoObject = this.arrLayers[myIndex]; + + // TODO: Help from Kruti this._TrackUndoObject = this.arrTracks[myIndex]; dLayer = this.hashInstance.getItem(this._hashKey); @@ -761,7 +780,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[myIndex].deleted = true; this.arrLayers.splice(myIndex, 1); - this.arrTracks.splice(myIndex, 1); + //this.arrTracks.splice(myIndex, 1); this._LayerUndoIndex = this._LayerUndoObject.layerID; this._LayerUndoPosition = myIndex; @@ -781,6 +800,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._LayerUndoPosition = this.arrLayers.length - 1; this._LayerUndoObject = this.arrLayers.pop(); this._LayerUndoIndex = this._LayerUndoObject.layerID; + + // TODO: Help from Kruti this._TrackUndoObject = this.arrTracks.pop(); } } @@ -1025,7 +1046,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.layerRepetition.selectedIndexes = [layerIndex]; this.trackRepetition.selectedIndexes = [layerIndex]; this.currentLayerSelected = this.arrLayers[layerIndex]; - this.currentTrackSelected = this.arrTracks[layerIndex]; + //this.currentTrackSelected = this.arrTracks[layerIndex]; if(!this._openDoc){ if(this._captureSelection){ if(this.currentLayerSelected.elementsList.length >= 1){ -- cgit v1.2.3 From 8b08cbf68180187fe3913ea853adc0f65895fde5 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Thu, 1 Mar 2012 21:54:35 -0800 Subject: Fix for selection change event handler event handler wasn't being executed because of incorrect handler function name Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 49f044d7..9819d7e1 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -405,7 +405,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, - captureSelectionChange:{ + handleSelectionChange:{ value:function(){ var key , switchSelectedLayer,layerIndex; if(this.application.ninja.selectedElements[0]){ @@ -416,7 +416,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._captureSelection=false; this.selectLayer(layerIndex); this._captureSelection=true; - } } } -- cgit v1.2.3 From ef41a2897809d768e066ee3b4bfbb436ab20175c Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Thu, 1 Mar 2012 23:58:41 -0800 Subject: Timeline bug fixes and cleanup Deselect tweens on every selection change. Replace JS alerts with console logs. Cleanup obsolete models and references. Signed-off-by: Jonathan Duran --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 90 +++++----------------- 1 file changed, 19 insertions(+), 71 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 9819d7e1..93fd170e 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -44,14 +44,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._layerRepetition = newVal; } }, + _cacheArrays : { value: function() { - // Cache this.arrLayers and this.arrTracks. - //this.log('cacheArrays ' + this._boolCacheArrays) if (this._boolCacheArrays) { - //this.log('caching arrays for ', this.application.ninja.currentDocument.name); this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; - //this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; } } }, @@ -80,10 +77,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { value: null }, - currentTrackSelected:{ - value: null - }, - millisecondsOffset:{ value:1000 }, @@ -181,22 +174,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { value:false, writable:true }, + timeMarkerHolder:{ value: null }, /* === END: Models === */ - /* === BEGIN: Draw cycle === */ prepareForDraw:{ - value:function () { - this.initTimeline(); - this.eventManager.addEventListener("onOpenDocument", this, false); - this.eventManager.addEventListener("closeDocument", this, false); - this.eventManager.addEventListener("switchDocument", this, false); - } - }, + value:function () { + this.initTimeline(); + this.eventManager.addEventListener("onOpenDocument", this, false); + this.eventManager.addEventListener("closeDocument", this, false); + this.eventManager.addEventListener("switchDocument", this, false); + } + }, - willDraw:{ value:function () { if (this._isLayer) { @@ -206,9 +198,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, /* === END: Draw cycle === */ - /* === BEGIN: Controllers === */ - // Bind all document-specific events (pass in true to unbind) _bindDocumentEvents : { value: function(boolUnbind) { @@ -259,7 +249,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.drawTimeMarkers(); this._hashKey = "123"; - // Document switching // Check to see if we have saved timeline information in the currentDocument. if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { @@ -300,7 +289,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } else { // we do have information stored. Use it. - this.log('oldfile ' + this.application.ninja.currentDocument.name) this._boolCacheArrays = false; this.arrLayers = []; this.arrTracks = []; @@ -313,8 +301,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.layerRepetition.needsDraw = true; this.trackRepetition.needsDraw = true; this.needsDraw = true; - - } }, @@ -323,7 +309,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Remove events this._bindDocumentEvents(true); - // Remove every event listener for every tween in TimelineTrack + // Remove every event listener for every selected tween in the timeline this.deselectTweens(); // Reset visual appearance @@ -342,21 +328,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.currentLayerNumber = 0; this.currentLayerSelected = false; - this.currentTrackSelected = false; this.selectedKeyframes = []; this.selectedTweens = []; this._captureSelection = false; this._openDoc = false; this.end_hottext.value = 25; this.updateTrackContainerWidth(); - } }, - handleOnOpenDocument:{ value:function(){ - this._boolCacheArrays = false; this.clearTimelinePanel(); this._boolCacheArrays = true; @@ -367,8 +349,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.hashLayerNumber = this.createLayerNumberHash(); this.hashElementMapToLayer = this.createElementMapToLayer(); this.initTimelineForDocument(); - - } }, @@ -393,7 +373,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (this.timeMarkerHolder) { this.time_markers.removeChild(this.timeMarkerHolder); } - this.drawTimeMarkers(); } }, @@ -408,6 +387,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleSelectionChange:{ value:function(){ var key , switchSelectedLayer,layerIndex; + this.deselectTweens(); if(this.application.ninja.selectedElements[0]){ key = this.application.ninja.selectedElements[0].uuid; switchSelectedLayer = this.hashElementMapToLayer.getItem(key); @@ -468,7 +448,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleDeleteLayerClick:{ value:function (event) { - this.log('handleDeleteLayerClick called') if (this.arrLayers.length === 1) { // do not delete last layer return; @@ -488,7 +467,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleLayerBinding:{ value:function (event) { var i = 0; - if (this._firstTimeLoaded) { this._firstTimeLoaded = false; } else { @@ -524,7 +502,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleNewLayer:{ value:function (event) { var hashIndex = 0 , hashVariable = 0, layerResult, trackResult, layerObject, trackObject, dLayer, parentNode; - if (this._hashFind) { while (layerResult = this.returnedObject[hashIndex]) { trackResult = this.returnedTrack[hashIndex]; @@ -556,10 +533,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } hashVariable++; } - - } - - else if (event.detail._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { + } else if (event.detail._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); while (dLayer[hashVariable]) { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { @@ -618,6 +592,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.trackPosition = 0; thingToPush.arrStyleTracks = []; thingToPush.tweens = []; + if (_firstLayerDraw) { this.application.ninja.currentSelectedContainer.uuid=this._hashKey; @@ -629,18 +604,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { event.detail.ele.uuid =nj.generateRandom(); thingToPush.elementsList.push(event.detail.ele); } - /* - newTrack.trackID = this.currentLayerNumber; - newTrack.isMainCollapsed = true; - newTrack.isPositionCollapsed = true; - newTrack.isTransformCollapsed = true; - newTrack.isStyleCollapsed = true; - newTrack.isTrackAnimated = false; - newTrack.currentKeyframeRule = null; - newTrack.trackPosition = 0; - newTrack.arrStyleTracks = []; - newTrack.tweens = []; - */ if (_firstLayerDraw) { if (this.application.ninja.currentSelectedContainer.id === "UserContent") { @@ -654,9 +617,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { myIndex = this.layerRepetition.selectedIndexes[0]; thingToPush.layerPosition = myIndex; thingToPush.isSelected = true; - //newTrack.trackPosition = myIndex; thingToPush.trackPosition = myIndex; - //this.arrTracks.splice(myIndex, 0, newTrack); this.arrLayers.splice(myIndex, 0, thingToPush); this._LayerUndoPosition = myIndex; this.selectLayer(myIndex); @@ -666,7 +627,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // TODO: Help from Kruti this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); } else { - //this.arrTracks.splice(0, 0, newTrack); this.arrLayers.splice(0, 0, thingToPush); thingToPush.layerPosition = this.arrLayers.length - 1; @@ -689,9 +649,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._LayerUndoIndex = thingToPush.layerID; this._LayerUndoStatus = true; this._TrackUndoObject = newTrack; - - - } } }, @@ -699,7 +656,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleDeleteLayer:{ value:function (event) { var dLayer, dTrack, parentNode, hashVariable = 0, k = 0, index = 0, j = 0; - if (this.arrLayers.length > 0) { if (event.detail._undoStatus) { if (this.application.ninja.currentSelectedContainer.id === "UserContent" && event.detail._el.parentElementUUID === 123) { @@ -810,13 +766,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleElementAdded:{ value:function (event) { - event.detail.uuid=nj.generateRandom(); if(this.currentLayerSelected.elementsList[0]!==undefined){ - if(this.currentTrackSelected.isTrackAnimated){ - this.application.ninja.stage.clearDrawingCanvas(); - this.log("cannot add elements to a layer with animated element"); - return; + if(this.currentLayerSelected.isTrackAnimated){ + // need to prevent element adding to dom, not just clear the drawing canvas + //this.application.ninja.stage.clearDrawingCanvas(); + console.log("cannot add elements to a layer with animated element"); }else{ this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected); this.currentLayerSelected.elementsList.push(event.detail); @@ -830,7 +785,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleElementDeleted:{ value:function (event) { - var length; this.deleteElement = event.detail; length = this.currentLayerSelected.elementsList.length - 1; @@ -891,7 +845,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { createLayerHashTable:{ value:function (key, value) { var hashLayerObject; - hashLayerObject = Object.create(Object.prototype, { counter:{ value:0, @@ -1026,13 +979,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { selectLayer:{ value:function (layerIndex) { - var i = 0, - arrLayersLength = this.arrLayers.length; + var i = 0; + var arrLayersLength = this.arrLayers.length; if(this.selectedKeyframes){ this.deselectTweens(); } - for (i = 0; i < arrLayersLength; i++) { if (i === layerIndex) { this.arrLayers[i].isSelected = true; @@ -1040,12 +992,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.arrLayers[i].isSelected = false; } } - if (layerIndex !== false) { this.layerRepetition.selectedIndexes = [layerIndex]; this.trackRepetition.selectedIndexes = [layerIndex]; this.currentLayerSelected = this.arrLayers[layerIndex]; - //this.currentTrackSelected = this.arrTracks[layerIndex]; if(!this._openDoc){ if(this._captureSelection){ if(this.currentLayerSelected.elementsList.length >= 1){ @@ -1060,9 +1010,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.layerRepetition.selectedIndexes = null; this.trackRepetition.selectedIndexes = null; this.currentLayerSelected = null; - this.currentTrackSelected = null; } - } }, -- cgit v1.2.3 From e2f581a20a365113d7b9a5126df3660d6d0644b5 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 2 Mar 2012 10:34:57 -0800 Subject: Timeline: Fix TODOs for consolidating repetition objects. --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 93fd170e..2001c3fb 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -501,14 +501,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { handleNewLayer:{ value:function (event) { - var hashIndex = 0 , hashVariable = 0, layerResult, trackResult, layerObject, trackObject, dLayer, parentNode; + var hashIndex = 0 , hashVariable = 0, layerResult, layerObject, trackObject, dLayer, parentNode; if (this._hashFind) { while (layerResult = this.returnedObject[hashIndex]) { - trackResult = this.returnedTrack[hashIndex]; + // trackResult = this.returnedTrack[hashIndex]; if (layerResult.deleted !== true) { - // TODO: Help from Kruti - this.arrTracks.push(trackResult); + + //this.arrTracks.push(trackResult); this.arrLayers.push(layerResult); } @@ -524,8 +524,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; - // TODO: Help from Kruti - this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); + + //this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); break; @@ -550,8 +550,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; - // TODO: Help from Kruti - this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); + + //this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); break; @@ -624,18 +624,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); - // TODO: Help from Kruti - this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); + + //this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); } else { this.arrLayers.splice(0, 0, thingToPush); thingToPush.layerPosition = this.arrLayers.length - 1; - // TODO: Help from Kruti - newTrack.trackPosition = this.arrTracks.length - 1; + //newTrack.trackPosition = this.arrTracks.length - 1; this._LayerUndoPosition = this.arrLayers.length - 1; this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); - this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); + //this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); this.selectLayer(0); } @@ -727,8 +726,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { var myIndex = this.layerRepetition.selectedIndexes[0]; this._LayerUndoObject = this.arrLayers[myIndex]; - // TODO: Help from Kruti - this._TrackUndoObject = this.arrTracks[myIndex]; + + //this._TrackUndoObject = this.arrTracks[myIndex]; dLayer = this.hashInstance.getItem(this._hashKey); dTrack = this.hashTrackInstance.getItem(this._hashKey); @@ -756,8 +755,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._LayerUndoObject = this.arrLayers.pop(); this._LayerUndoIndex = this._LayerUndoObject.layerID; - // TODO: Help from Kruti - this._TrackUndoObject = this.arrTracks.pop(); + + //this._TrackUndoObject = this.arrTracks.pop(); } } } -- cgit v1.2.3 From 5689e3e2deda1b1f7ba32f6007ddab20f6c1fe64 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 2 Mar 2012 18:17:14 -0800 Subject: Timeline: Serialization of all Collapser components --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 30 ++++------------------ 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 2001c3fb..7be34d74 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -97,22 +97,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, - _arrTracks:{ - serializable:true, - value:[] - }, - - arrTracks:{ - serializable:true, - get:function () { - return this._arrTracks; - }, - set:function (newVal) { - this._arrTracks = newVal; - this._cacheArrays(); - } - }, - _trackRepetition:{ serializable:true, value:null @@ -284,23 +268,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { _firstLayerDraw = true; // After recreating the tracks and layers, store the result in the currentDocument. - this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; } else { // we do have information stored. Use it. this._boolCacheArrays = false; - this.arrLayers = []; - this.arrTracks = []; + //this.arrLayers = []; this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; - this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; this._boolCacheArrays = true; } // Redraw all the things - this.layerRepetition.needsDraw = true; - this.trackRepetition.needsDraw = true; - this.needsDraw = true; + //this.layerRepetition.needsDraw = true; + //this.trackRepetition.needsDraw = true; + //this.needsDraw = true; } }, @@ -323,7 +304,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.hashTrackInstance = null; this.hashLayerNumber = null; this.hashElementMapToLayer = null; - this.arrTracks = []; this.arrLayers = []; this.currentLayerNumber = 0; @@ -471,7 +451,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._firstTimeLoaded = false; } else { this.arrLayers.length = 0; - this.arrTracks.length = 0; if (event.detail.element.id === "UserContent") { this._hashKey = "123"; @@ -578,6 +557,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { newLayerName = "Layer " + this.currentLayerNumber; thingToPush.layerName = newLayerName; thingToPush.layerID = this.currentLayerNumber; + thingToPush.bypassAnimation = false; thingToPush.isMainCollapsed = true; thingToPush.isPositionCollapsed = true; thingToPush.isTransformCollapsed = true; -- cgit v1.2.3 From 11f39321cf1f2b5f3790ed819051f56411e98261 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Mon, 5 Mar 2012 11:59:31 -0800 Subject: Timeline: Removing Events for Adding and Deleting Layer, Taking care of BreadCrumb Signed-off-by: Kruti Shah --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 326 +++++++++------------ 1 file changed, 141 insertions(+), 185 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 93fd170e..48181ae7 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -156,6 +156,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, + _breadCrumbContainer:{ + value:null + }, + + breadCrumbContainer: { + set: function(value) { + if(this._breadCrumbContainer !== value) { + this._breadCrumbContainer = value; + this.LayerBinding(this.application.ninja.currentSelectedContainer); + } + }, + get: function() { + return this._breadCrumbContainer; + } + }, + _isLayer:{ value:false }, @@ -221,6 +237,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { for (i = 0; i < arrEventsLength; i++) { this.eventManager.addEventListener(arrEvents[i], this, false); } + Object.defineBinding(this, "breadCrumbContainer", { + boundObject: this.application.ninja, + boundObjectPropertyPath:"currentSelectedContainer", + oneway: true + }); } } }, @@ -247,8 +268,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { value:function () { var myIndex; this.drawTimeMarkers(); - this._hashKey = "123"; - + this._hashKey = this.application.ninja.currentSelectedContainer.uuid; // Document switching // Check to see if we have saved timeline information in the currentDocument. if (typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined") { @@ -268,16 +288,16 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while(this.application.ninja.currentDocument.documentRoot.children[myIndex]) { this._openDoc=true; - NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]}) + this.restoreLayer(this.application.ninja.currentDocument.documentRoot.children[myIndex]); myIndex++; } } else{ - NJevent('newLayer', this._hashKey); + this.restoreLayer(1); this.selectLayer(0); } }else{ - NJevent('newLayer', this._hashKey); + this.createNewLayer(1); this.selectLayer(0); } @@ -332,6 +352,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.selectedTweens = []; this._captureSelection = false; this._openDoc = false; + this._firstTimeLoaded=true; this.end_hottext.value = 25; this.updateTrackContainerWidth(); } @@ -345,7 +366,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._bindDocumentEvents(); this.hashInstance = this.createLayerHashTable(); - this.hashTrackInstance = this.createTrackHashTable(); this.hashLayerNumber = this.createLayerNumberHash(); this.hashElementMapToLayer = this.createElementMapToLayer(); this.initTimelineForDocument(); @@ -456,34 +476,26 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // nothing is selected, do not delete return; } - this._deleteKeyDown = false; - if (this.application.ninja.currentSelectedContainer.id === "UserContent") { - this._hashKey = "123"; - } this.removeLayer(); } }, - handleLayerBinding:{ - value:function (event) { + LayerBinding:{ + value:function (node) { var i = 0; + if (this._firstTimeLoaded) { this._firstTimeLoaded = false; } else { this.arrLayers.length = 0; this.arrTracks.length = 0; + this._hashKey = node.uuid; - if (event.detail.element.id === "UserContent") { - this._hashKey = "123"; - } else { - this._hashKey = event.detail.element.uuid; - } if (this.returnedObject = this.hashInstance.getItem(this._hashKey)) { - this.returnedTrack = this.hashTrackInstance.getItem(this._hashKey); this._hashFind = true; } this.currentLayerNumber = 0; - NJevent('newLayer', event.detail); + this.createNewLayer(1); this.selectLayer(0); } } @@ -499,44 +511,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, - handleNewLayer:{ - value:function (event) { - var hashIndex = 0 , hashVariable = 0, layerResult, trackResult, layerObject, trackObject, dLayer, parentNode; - if (this._hashFind) { - while (layerResult = this.returnedObject[hashIndex]) { - trackResult = this.returnedTrack[hashIndex]; - if (layerResult.deleted !== true) { - - // TODO: Help from Kruti - this.arrTracks.push(trackResult); - this.arrLayers.push(layerResult); - - } - hashIndex++; - } - this._hashFind = false; - return; - } - if (event.detail._undoStatus) { - if (this.application.ninja.currentSelectedContainer.id === "UserContent" && event.detail._el.parentElementUUID === 123) { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); - while (dLayer[hashVariable]) { - if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { - dLayer[hashVariable].deleted = false; - - // TODO: Help from Kruti - this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); - this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); - this.selectLayer(event.detail._layerPosition); - break; + createNewLayer:{ + value:function(object){ + var hashVariable = 0; - } - hashVariable++; - } - } else if (event.detail._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); + if (object._undoStatus) { + if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { + dLayer = this.hashInstance.getItem(object._el.parentElementUUID); while (dLayer[hashVariable]) { - if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { + if (dLayer[hashVariable]._layerID === object._el._layerID) { dLayer[hashVariable].deleted = false; parentNode = dLayer[hashVariable].parentElement; break; @@ -544,26 +527,97 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { hashVariable++; } this.application.ninja.currentSelectedContainer = parentNode; + this.LayerBinding(parentNode); } else { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); + dLayer = this.hashInstance.getItem(object._el.parentElementUUID); while (dLayer[hashVariable]) { - if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { + if (dLayer[hashVariable]._layerID === object._el._layerID) { dLayer[hashVariable].deleted = false; - - // TODO: Help from Kruti - this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); - this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); - this.selectLayer(event.detail._layerPosition); + + this.arrLayers.splice(object._layerPosition, 0, object._el); + this.selectLayer(object._layerPosition); break; } hashVariable++; } } + }else{ + + var newLayerName = "", + thingToPush = {}, + myIndex = 0; + + this.currentLayerNumber = this.hashLayerNumber.getItem(this._hashKey); + if (this.currentLayerNumber === undefined) { + this.currentLayerNumber = 0; } + this.currentLayerNumber = this.currentLayerNumber + 1; + newLayerName = "Layer " + this.currentLayerNumber; + thingToPush.layerName = newLayerName; + thingToPush.layerID = this.currentLayerNumber; + thingToPush.isMainCollapsed = true; + thingToPush.isPositionCollapsed = true; + thingToPush.isTransformCollapsed = true; + thingToPush.isStyleCollapsed = true; + thingToPush.arrLayerStyles = []; + thingToPush.elementsList = []; + thingToPush.deleted = false; + thingToPush.isSelected = false; + thingToPush.created=false; + thingToPush.isTrackAnimated = false; + thingToPush.currentKeyframeRule = null; + thingToPush.trackPosition = 0; + thingToPush.arrStyleTracks = []; + thingToPush.tweens = []; + + thingToPush.parentElementUUID = this._hashKey; + thingToPush.parentElement = this.application.ninja.currentSelectedContainer; + + if (!!this.layerRepetition.selectedIndexes) { + myIndex = this.layerRepetition.selectedIndexes[0]; + thingToPush.layerPosition = myIndex; + thingToPush.isSelected = true; + thingToPush.trackPosition = myIndex; + this.arrLayers.splice(myIndex, 0, thingToPush); + this._LayerUndoPosition = myIndex; + this.selectLayer(myIndex); + this.hashLayerNumber.setItem(this._hashKey, thingToPush); + this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); - else { + } else { + this.arrLayers.splice(0, 0, thingToPush); + thingToPush.layerPosition = this.arrLayers.length - 1; + this._LayerUndoPosition = this.arrLayers.length - 1; + this.hashLayerNumber.setItem(this._hashKey, thingToPush); + this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); + this.selectLayer(0); + + } + + this._LayerUndoObject = thingToPush; + this._LayerUndoIndex = thingToPush.layerID; + this._LayerUndoStatus = true; + } + + } + }, + + restoreLayer:{ + value:function (ele) { + var hashIndex = 0 ,layerResult + if (this._hashFind) { + while (layerResult = this.returnedObject[hashIndex]) { + if (layerResult.deleted !== true) { + this.arrLayers.push(layerResult); + + } + hashIndex++; + } + this._hashFind = false; + return; + }else { var newLayerName = "", thingToPush = {}, newTrack = {}, @@ -593,24 +647,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.arrStyleTracks = []; thingToPush.tweens = []; - if (_firstLayerDraw) { - - this.application.ninja.currentSelectedContainer.uuid=this._hashKey; - thingToPush.parentElementUUID = this._hashKey; - thingToPush.parentElement = this.application.ninja.currentSelectedContainer; - } + thingToPush.parentElementUUID = this._hashKey; + thingToPush.parentElement = this.application.ninja.currentSelectedContainer; if(this._openDoc){ - event.detail.ele.uuid =nj.generateRandom(); - thingToPush.elementsList.push(event.detail.ele); - } - - if (_firstLayerDraw) { - if (this.application.ninja.currentSelectedContainer.id === "UserContent") { - this._hashKey = "123"; - this.application.ninja.currentSelectedContainer.uuid=this._hashKey; - thingToPush.parentElementUUID = 123; - } + ele.uuid =nj.generateRandom(); + thingToPush.elementsList.push(ele); } if (!!this.layerRepetition.selectedIndexes) { @@ -623,91 +665,58 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.selectLayer(myIndex); this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); - - // TODO: Help from Kruti - this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); + } else { this.arrLayers.splice(0, 0, thingToPush); thingToPush.layerPosition = this.arrLayers.length - 1; - - // TODO: Help from Kruti - newTrack.trackPosition = this.arrTracks.length - 1; this._LayerUndoPosition = this.arrLayers.length - 1; this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, thingToPush.layerPosition); - this.hashTrackInstance.setItem(this._hashKey, newTrack, newTrack.trackPosition); this.selectLayer(0); } if(this._openDoc){ var selectedIndex = this.getLayerIndexByID(thingToPush.layerID) - this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.arrLayers[selectedIndex]); + this.hashElementMapToLayer.setItem(ele.uuid,ele,this.arrLayers[selectedIndex]); this._openDoc=false; } this._LayerUndoObject = thingToPush; this._LayerUndoIndex = thingToPush.layerID; this._LayerUndoStatus = true; - this._TrackUndoObject = newTrack; + } } }, - handleDeleteLayer:{ - value:function (event) { - var dLayer, dTrack, parentNode, hashVariable = 0, k = 0, index = 0, j = 0; + deleteLayer:{ + value:function (object) { + var dLayer,parentNode, hashVariable = 0, k = 0, index = 0, j = 0; if (this.arrLayers.length > 0) { - if (event.detail._undoStatus) { - if (this.application.ninja.currentSelectedContainer.id === "UserContent" && event.detail._el.parentElementUUID === 123) { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); + if (object._undoStatus) { + if (object._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { + dLayer = this.hashInstance.getItem(object._el.parentElementUUID); while (dLayer[hashVariable]) { - if (dLayer[hashVariable].deleted === true) { - - } else if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { - while (this.arrLayers.length) { - if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) { - dLayer[hashVariable].deleted = true; -// ElementMediator.deleteElements(dLayer[myIndex].element); - this.arrLayers.splice(k, 1); - //this.arrTracks.splice(k, 1); - if(k>0){ - this.selectLayer(k-1); - }else{ - this.selectLayer(k) - } - break; - } - k++; - } - } - hashVariable++; - } - - } else if (event.detail._el.parentElementUUID !== this.application.ninja.currentSelectedContainer.uuid) { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); - while (dLayer[hashVariable]) { - if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { + if (dLayer[hashVariable]._layerID === object._el._layerID) { dLayer[hashVariable].deleted = true; -// ElementMediator.deleteElements(dLayer[myIndex].element); parentNode = dLayer[hashVariable].parentElement; break; } hashVariable++; } this.application.ninja.currentSelectedContainer = parentNode; + this.LayerBinding(parentNode); } else { - dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID); + dLayer = this.hashInstance.getItem(object._el.parentElementUUID); while (dLayer[hashVariable]) { if (dLayer[hashVariable].deleted === true) { - } else if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { + } else if (dLayer[hashVariable]._layerID === object._el._layerID) { while (this.arrLayers.length) { if (dLayer[hashVariable]._layerID === this.arrLayers[k]._layerID) { dLayer[hashVariable].deleted = true; -// ElementMediator.deleteElements(dLayer[myIndex].element); this.arrLayers.splice(k, 1); - //this.arrTracks.splice(k, 1); if(k>0){ this.selectLayer(k-1); }else{ @@ -726,16 +735,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (!!this.layerRepetition.selectedIndexes) { var myIndex = this.layerRepetition.selectedIndexes[0]; this._LayerUndoObject = this.arrLayers[myIndex]; - - // TODO: Help from Kruti - this._TrackUndoObject = this.arrTracks[myIndex]; dLayer = this.hashInstance.getItem(this._hashKey); - dTrack = this.hashTrackInstance.getItem(this._hashKey); dLayer[myIndex].deleted = true; this.arrLayers.splice(myIndex, 1); - //this.arrTracks.splice(myIndex, 1); this._LayerUndoIndex = this._LayerUndoObject.layerID; this._LayerUndoPosition = myIndex; @@ -749,15 +753,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } else { dLayer = this.hashInstance.getItem(this._hashKey); - dTrack = this.hashTrackInstance.getItem(this._hashKey); dLayer[this.arrLayers.length - 1].deleted = true; ElementMediator.deleteElements(dLayer[this.arrLayers.length - 1].elementsList); this._LayerUndoPosition = this.arrLayers.length - 1; this._LayerUndoObject = this.arrLayers.pop(); this._LayerUndoIndex = this._LayerUndoObject.layerID; - - // TODO: Help from Kruti - this._TrackUndoObject = this.arrTracks.pop(); + } } } @@ -883,46 +884,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } }, - createTrackHashTable:{ - value:function (key, value) { - var hashTrackObject; - hashTrackObject = Object.create(Object.prototype, { - counter:{ - value:0, - writable:true - }, - - setItem:{ - value:function (key, value, index) { - if (hashTrackObject[key] === undefined) { - hashTrackObject[key] = {}; - - } - if (hashTrackObject[key][index] !== undefined) { - this.counter = index; - while (hashTrackObject[key][this.counter]) { - this.counter++; - } - while (this.counter !== index) { - hashTrackObject[key][this.counter] = hashTrackObject[key][this.counter - 1]; - this.counter = this.counter - 1; - } - } - hashTrackObject[key][index] = value; - this.counter = 0; - } - }, - - getItem:{ - value:function (key) { - return hashTrackObject[key]; - } - } - }); - return hashTrackObject; - } - }, - createLayerNumberHash:{ value:function (key, value) { var hashLayerNumberObject; @@ -1067,7 +1028,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { cmd._layerID = this._LayerUndoIndex; cmd._layerPosition = this._LayerUndoPosition; cmd._undoStatus = this._LayerUndoStatus; - cmd._track = this._TrackUndoObject; NJevent("sendToUndo", cmd); } }, @@ -1080,7 +1040,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { cmd._layerID = this._LayerUndoIndex; cmd._layerPosition = this._LayerUndoPosition; cmd._undoStatus = this._LayerUndoStatus; - cmd._track = this._TrackUndoObject; NJevent("sendToUndo", cmd); } @@ -1089,26 +1048,22 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { addLayerCommand:{ value:function () { var command; + var that=this; command = Object.create(Object.prototype, { _el:{value:null, writable:true}, _layerID:{value:null, writable:true}, _layerPosition:{value:null, writable:true}, _undoStatus:{value:false, writable:true}, - _track:{value:null, writable:true}, description:{ value:"Add Layer"}, receiver:{value:TimelinePanel}, execute:{ value:function () { - - NJevent('newLayer', this) - - + that.createNewLayer(this); } }, unexecute:{ value:function () { - NJevent('deleteLayer', this) - + that.deleteLayer(this); } } }); @@ -1119,17 +1074,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { deleteLayerCommand:{ value:function () { var command; + var that=this; command = Object.create(Object.prototype, { description:{ value:"Delete Layer"}, receiver:{value:TimelinePanel}, execute:{ value:function () { - NJevent('deleteLayer', this) + that.deleteLayer(this); } }, unexecute:{ value:function () { - NJevent('newLayer', this) + that.createNewLayer(this); } } }); -- cgit v1.2.3 From e9f46776738343af427260190d0eddbd41fbbba3 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Mon, 5 Mar 2012 16:21:11 -0800 Subject: Timeline: Fixing the layer switching Signed-off-by: Kruti Shah --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 48181ae7..4e7c71d0 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -277,11 +277,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.application.ninja.currentDocument.isTimelineInitialized = true; this.application.ninja.currentDocument.tlArrLayers = []; this.application.ninja.currentDocument.tlArrTracks = []; +// this.application.ninja.currentDocument.layerNumber = 0; // Loop through the DOM of the document to find layers and animations. // Fire off events as they are found. - _firstLayerDraw = false; if(!this.application.ninja.documentController.creatingNewFile){ if(this.application.ninja.currentDocument.documentRoot.children[0]){ myIndex=0; @@ -301,11 +301,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.selectLayer(0); } - _firstLayerDraw = true; - // After recreating the tracks and layers, store the result in the currentDocument. this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; +// this.application.ninja.currentDocument.layerNumber = this.layerNumber; +// console.log(this.application.ninja.currentDocument) +// console.log(this.application.ninja.currentDocument.tlArrLayers); } else { // we do have information stored. Use it. @@ -314,6 +315,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.arrTracks = []; this.arrLayers = this.application.ninja.currentDocument.tlArrLayers; this.arrTracks = this.application.ninja.currentDocument.tlArrTracks; +// this.layerNumber = this.application.ninja.currentDocument.layerNumber; this._boolCacheArrays = true; } @@ -340,7 +342,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Clear variables--including repetitions. this.hashInstance = null; - this.hashTrackInstance = null; this.hashLayerNumber = null; this.hashElementMapToLayer = null; this.arrTracks = []; @@ -481,22 +482,24 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { }, LayerBinding:{ - value:function (node) { - var i = 0; + value:function (node) { + var i = 0; - if (this._firstTimeLoaded) { - this._firstTimeLoaded = false; - } else { - this.arrLayers.length = 0; - this.arrTracks.length = 0; - this._hashKey = node.uuid; + if(typeof(this.application.ninja.currentDocument.isTimelineInitialized) === "undefined"){ + if (this._firstTimeLoaded) { +