diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 2143dafd..9519730e 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -172,6 +172,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
prepareForDraw:{
value:function () {
this.eventManager.addEventListener( "onOpenDocument", this, false);
+ var that = this;
+ this.getme.addEventListener("click", function() {
+ that.clearTimelinePanel();
+ }, false)
}
},
@@ -246,11 +250,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
clearTimelinePanel : {
value: function() {
console.log('clearing timeline...')
- this.arrTracks = null;
- this.arrLayers = null;
+ // update playhead position and time text
+ this.application.ninja.timeline.playhead.style.left = "-2px";
+ this.application.ninja.timeline.playheadmarker.style.left = "0px";
+ this.application.ninja.timeline.updateTimeText(0.00);
+ this.timebar.style.width = "0px";
+
+ this.arrTracks = [];
+ this.arrLayers = [];
this.currentLayerNumber = 0;
- this.currentLayerSelected = null;
- this.currentTrackSelected = null;
+ this.currentLayerSelected = false;
+ this.currentTrackSelected = false;
this.selectedKeyframes = [];
this.selectedTweens = [];
this._captureSelection = false;
--
cgit v1.2.3
From 5179adf63d25856a8ee96005678d7a6ac626cba6 Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Mon, 27 Feb 2012 13:31:39 -0800
Subject: Timeline: More work on clear timeline method.
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 53 +++++++++++++++++-----
1 file changed, 42 insertions(+), 11 deletions(-)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index d7ce7079..0feada6b 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -171,11 +171,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
/* === BEGIN: Draw cycle === */
prepareForDraw:{
value:function () {
+ this.initTimeline();
this.eventManager.addEventListener( "onOpenDocument", this, false);
- var that = this;
- this.getme.addEventListener("click", function() {
- that.clearTimelinePanel();
- }, false)
+ this.eventManager.addEventListener("closeDocument", this, false);
}
},
@@ -198,6 +196,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
}
},
+
+ handleCloseDocument: {
+ value: function(event) {
+ this.clearTimelinePanel();
+ }
+ },
willDraw:{
value:function () {
if (this._isLayer) {
@@ -209,10 +213,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
/* === END: Draw cycle === */
/* === BEGIN: Controllers === */
- initTimelineView:{
- value:function () {
- var myIndex;
- this.layout_tracks = this.element.querySelector(".layout-tracks");
+ initTimeline : {
+ value: function() {
+ // Set up basic Timeline functions: event listeners, etc. Things that only need to be run once.
+ this.layout_tracks = this.element.querySelector(".layout-tracks");
this.layout_markers = this.element.querySelector(".layout_markers");
this.newlayer_button.identifier = "addLayer";
@@ -223,6 +227,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.layout_tracks.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
this.user_layers.addEventListener("scroll", this.updateLayerScroll.bind(this), false);
this.end_hottext.addEventListener("changing", this.updateTrackContainerWidth.bind(this), false);
+
+ }
+ },
+ initTimelineView:{
+ value:function () {
+ var myIndex;
+
this.drawTimeMarkers();
@@ -253,13 +264,27 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
clearTimelinePanel : {
value: function() {
- console.log('clearing timeline...')
- // update playhead position and time text
+ // Remove events
+ this.eventManager.removeEventListener("deleteLayerClick", this, false);
+ this.eventManager.removeEventListener("newLayer", this, false);
+ this.eventManager.removeEventListener("deleteLayer", this, false);
+ this.eventManager.removeEventListener("layerBinding", this, false);
+ this.eventManager.removeEventListener("elementAdded", this, false);
+ this.eventManager.removeEventListener("elementDeleted", this, false);
+ this.eventManager.removeEventListener("deleteSelection", this, false);
+ this.eventManager.removeEventListener("selectionChange", this, true);
+
+ // Reset visual appearance
this.application.ninja.timeline.playhead.style.left = "-2px";
this.application.ninja.timeline.playheadmarker.style.left = "0px";
this.application.ninja.timeline.updateTimeText(0.00);
this.timebar.style.width = "0px";
+ // Clear variables--including repetitions.
+ this.hashInstance = null;
+ this.hashTrackInstance = null;
+ this.hashLayerNumber = null;
+ this.hashElementMapToLayer = null;
this.arrTracks = [];
this.arrLayers = [];
this.currentLayerNumber = 0;
@@ -271,6 +296,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this._openDoc = false;
this.end_hottext.value = 25;
this.updateTrackContainerWidth();
+
+ // Redraw all the things
+ this.layerRepetition.needsDraw = true;
+ this.trackRepetition.needsDraw = true;
this.needsDraw = true;
}
},
@@ -502,6 +531,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
if(this._openDoc){
event.detail.ele.uuid =nj.generateRandom();
+ console.log("in open doc")
+ console.log(event.detail.ele)
thingToPush.elementsList.push(event.detail.ele);
}
@@ -657,7 +688,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
handleElementAdded:{
value:function (event) {
-
+ console.log('called')
event.detail.uuid=nj.generateRandom();
this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
this.currentLayerSelected.elementsList.push(event.detail);
--
cgit v1.2.3
From 445180591da04f681a22038600e8ab517b82c0ca Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Mon, 27 Feb 2012 20:26:49 -0800
Subject: Timeline: try to clean up bogus events manually.
---
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 0feada6b..912dce83 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -273,6 +273,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.eventManager.removeEventListener("elementDeleted", this, false);
this.eventManager.removeEventListener("deleteSelection", this, false);
this.eventManager.removeEventListener("selectionChange", this, true);
+
+ // Remove every event listener for every tween in TimelineTrack
+ for (var i = 0; i < this.arrTracks.length; i++) {
+ for (var j = 0; j < this.arrTracks[i].tweens.length; j++) {
+ //this.eventManager.removeEventListener("elementChange", this, false);
+ this.arrTracks[i].tweens[j].eventManager.removeEventListener("elementChange", this.arrTracks[i].tweens[j], false);
+ }
+ }
// Reset visual appearance
this.application.ninja.timeline.playhead.style.left = "-2px";
--
cgit v1.2.3
From 0031310ea80a33b1752d3813070b00215f0c52c6 Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Mon, 27 Feb 2012 21:55:37 -0800
Subject: Timeline: Successfully unbind event listeners in tweens when clearing
timeline.
---
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 912dce83..69e6527f 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -277,8 +277,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
// Remove every event listener for every tween in TimelineTrack
for (var i = 0; i < this.arrTracks.length; i++) {
for (var j = 0; j < this.arrTracks[i].tweens.length; j++) {
- //this.eventManager.removeEventListener("elementChange", this, false);
- this.arrTracks[i].tweens[j].eventManager.removeEventListener("elementChange", this.arrTracks[i].tweens[j], false);
+ this.arrTracks[i].tweens[j].isClearing = "clear it";
}
}
@@ -539,8 +538,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
if(this._openDoc){
event.detail.ele.uuid =nj.generateRandom();
- console.log("in open doc")
- console.log(event.detail.ele)
thingToPush.elementsList.push(event.detail.ele);
}
@@ -696,7 +693,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
handleElementAdded:{
value:function (event) {
- console.log('called')
event.detail.uuid=nj.generateRandom();
this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
this.currentLayerSelected.elementsList.push(event.detail);
--
cgit v1.2.3
From 24f1817af33c18ac6f6e07cc0dc6a8e8c65f0949 Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Tue, 28 Feb 2012 13:09:55 -0800
Subject: Timeline: Basic document switching.
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 30 ++++++++++++++--------
1 file changed, 20 insertions(+), 10 deletions(-)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 69e6527f..c4206b18 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -28,6 +28,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrLayers = newVal;
+ this.application.ninja.currentDocument.tlArrLayers = newVal;
}
},
@@ -99,6 +100,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrTracks = newVal;
+ this.application.ninja.currentDocument.tlArrTracks = newVal;
}
},
@@ -172,13 +174,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
prepareForDraw:{
value:function () {
this.initTimeline();
- this.eventManager.addEventListener( "onOpenDocument", this, false);
+ this.eventManager.addEventListener("onOpenDocument", this, false);
this.eventManager.addEventListener("closeDocument", this, false);
+ this.eventManager.addEventListener("switchDocument", this, false);
}
},
handleOnOpenDocument:{
value:function(){
+ this.clearTimelinePanel();
this.eventManager.addEventListener("deleteLayerClick", this, false);
this.eventManager.addEventListener("newLayer", this, false);
this.eventManager.addEventListener("deleteLayer", this, false);
@@ -202,6 +206,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.clearTimelinePanel();
}
},
+
+ handleSwitchDocument : {
+ value: function(event) {
+ // Handle document change.
+ this.handleOnOpenDocument();
+ }
+ },
+
willDraw:{
value:function () {
if (this._isLayer) {
@@ -233,9 +245,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
initTimelineView:{
value:function () {
var myIndex;
-
-
- this.drawTimeMarkers();
+
+ this.drawTimeMarkers();
this._hashKey = "123";
_firstLayerDraw = false;
@@ -275,11 +286,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.eventManager.removeEventListener("selectionChange", this, true);
// Remove every event listener for every tween in TimelineTrack
- for (var i = 0; i < this.arrTracks.length; i++) {
- for (var j = 0; j < this.arrTracks[i].tweens.length; j++) {
- this.arrTracks[i].tweens[j].isClearing = "clear it";
- }
- }
+ this.deselectTweens();
// Reset visual appearance
this.application.ninja.timeline.playhead.style.left = "-2px";
@@ -316,7 +323,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.container_tracks.style.width = (this.end_hottext.value * 80) + "px";
this.master_track.style.width = (this.end_hottext.value * 80) + "px";
this.time_markers.style.width = (this.end_hottext.value * 80) + "px";
- this.time_markers.removeChild(this.timeMarkerHolder);
+ if (this.timeMarkerHolder) {
+ this.time_markers.removeChild(this.timeMarkerHolder);
+ }
+
this.drawTimeMarkers();
}
},
--
cgit v1.2.3
From 154f42e51464a51a83952d4293ef730cd1180e35 Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 13:21:14 -0800
Subject: Fix element selection on open doc
Signed-off-by: Jonathan Duran
---
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index c4206b18..85ce6a20 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -927,10 +927,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.trackRepetition.selectedIndexes = [layerIndex];
this.currentLayerSelected = this.arrLayers[layerIndex];
this.currentTrackSelected = this.arrTracks[layerIndex];
- if(this._captureSelection){
- this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList)
+ if(!this._openDoc){
+ if(this._captureSelection){
+ this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList)
+ }
+ this._captureSelection = true;
}
- this._captureSelection = true;
} else {
this.layerRepetition.selectedIndexes = null;
this.trackRepetition.selectedIndexes = null;
--
cgit v1.2.3
From 1f1e6265c982f09a97271788b138e4c8f805fc7a Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 13:31:34 -0800
Subject: Timeline : Deleting Layer deletes the element, Deleting Layer selects
another layer
Signed-off-by: Kruti Shah
Signed-off-by: Jonathan Duran
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 37 +++++++++++++++++-----
1 file changed, 29 insertions(+), 8 deletions(-)
(limited to 'js/panels/Timeline/TimelinePanel.reel')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 85ce6a20..01b03531 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -479,6 +479,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
dLayer[hashVariable].deleted = false;
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;
}
@@ -498,7 +499,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
hashVariable++;
}
this.application.ninja.currentSelectedContainer = parentNode;
- //NJevent('breadCrumbTrail', {"element":parentNode, "setFlag":this._setBreadCrumb});
} else {
dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
while (dLayer[hashVariable]) {
@@ -506,6 +506,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
dLayer[hashVariable].deleted = false;
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;
}
@@ -578,7 +579,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.arrTracks.splice(myIndex, 0, newTrack);
this.arrLayers.splice(myIndex, 0, thingToPush);
this._LayerUndoPosition = myIndex;
- this.selectLayer(myIndex);
+// this.selectLayer(myIndex);
this.hashLayerNumber.setItem(this._hashKey, thingToPush);
this.hashInstance.setItem(this._hashKey, thingToPush, myIndex);
this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex);
@@ -591,12 +592,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
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);
+// this.selectLayer(0);
}
if(this._openDoc){
- this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.currentLayerSelected);
+ var selectedIndex = this.getLayerIndexByID(thingToPush.layerID)
+ this.hashElementMapToLayer.setItem(event.detail.ele.uuid, event.detail.ele,this.arrLayers[selectedIndex]);
this._openDoc=false;
}
this._LayerUndoObject = thingToPush;
@@ -605,6 +607,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this._TrackUndoObject = newTrack;
+
}
}
},
@@ -627,6 +630,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
// 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++;
@@ -647,7 +655,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
hashVariable++;
}
this.application.ninja.currentSelectedContainer = parentNode;
- // NJevent('breadCrumbTrail', {"element":parentNode, "setFlag":this._setBreadCrumb});
}
else {
dLayer = this.hashInstance.getItem(event.detail._el.parentElementUUID);
@@ -661,6 +668,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
// 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++;
@@ -684,13 +696,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.arrTracks.splice(myIndex, 1);
this._LayerUndoIndex = this._LayerUndoObject.layerID;
this._LayerUndoPosition = myIndex;
- ElementMediator.deleteElements(dLayer[myIndex].ele);
+
+ if(myIndex===0){
+ this.selectLayer(0);
+ }
+ else{
+ this.selectLayer(myIndex-1);
+ }
+ ElementMediator.deleteElements(dLayer[myIndex].elementsList);
} 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].ele);
+ ElementMediator.deleteElements(dLayer[this.arrLayers.length - 1].elementsList);
this._LayerUndoPosition = this.arrLayers.length - 1;
this._LayerUndoObject = this.arrLayers.pop();
this._LayerUndoIndex = this._LayerUndoObject.layerID;
@@ -913,7 +932,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
if(this.selectedKeyframes){
this.deselectTweens();
}
-
+
for (i = 0; i < arrLayersLength; i++) {
if (i === layerIndex) {
this.arrLayers[i].isSelected = true;
@@ -939,6 +958,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.currentLayerSelected = null;
this.currentTrackSelected = null;
}
+
}
},
@@ -1030,6 +1050,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
NJevent('newLayer', this)
+
}
},
unexecute:{
--
cgit v1.2.3