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.
---
js/panels/Timeline/Layer.reel/Layer.js | 1 -
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 53 +++++++++++++++++-----
js/panels/Timeline/Tween.reel/Tween.js | 1 +
3 files changed, 43 insertions(+), 12 deletions(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index e75b4d0f..d50360e6 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -509,7 +509,6 @@ var Layer = exports.Layer = Montage.create(Component, {
this.styleCollapser.bypassAnimation = true;
this.styleCollapser.toggle();
}
-
if (this.isSelected) {
this.element.classList.add("selected");
} else {
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);
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index f6dbf32c..70b52297 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -140,6 +140,7 @@ var Tween = exports.Tween = Montage.create(Component, {
value:function (event) {
if (event.detail.source && event.detail.source !== "tween") {
// check for correct element selection
+ console.log(this.application.ninja.selectedElements[0]._element)
if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) {
alert("Wrong element selected for this keyframe track");
} else {
--
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 ++++++++
js/panels/Timeline/Tween.reel/Tween.js | 6 +++++-
2 files changed, 13 insertions(+), 1 deletion(-)
(limited to 'js/panels/Timeline')
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";
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 70b52297..a9ee1fec 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -138,9 +138,12 @@ var Tween = exports.Tween = Montage.create(Component, {
handleElementChange:{
value:function (event) {
+
if (event.detail.source && event.detail.source !== "tween") {
// check for correct element selection
- console.log(this.application.ninja.selectedElements[0]._element)
+ console.log("handleElementChange! " + this.tweenID)
+ console.log(this.application.ninja.selectedElements[0]._element);
+ console.log(this.parentComponent.parentComponent.animatedElement);
if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) {
alert("Wrong element selected for this keyframe track");
} else {
@@ -162,6 +165,7 @@ var Tween = exports.Tween = Montage.create(Component, {
selectTween:{
value: function(){
// turn on event listener for element change
+ console.log('adding elementChange event listener for tween ' + this.tweenID)
this.eventManager.addEventListener("elementChange", this, false);
// select the containing layer
--
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.
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 6 +-----
.../Timeline/TimelineTrack.reel/TimelineTrack.html | 5 +++++
js/panels/Timeline/Tween.reel/Tween.js | 19 +++++++++++++++----
3 files changed, 21 insertions(+), 9 deletions(-)
(limited to 'js/panels/Timeline')
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);
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
index 158d666e..26d045d6 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
@@ -62,6 +62,11 @@
"boundObject" : {"@": "tweenRepetition"},
"boundObjectPropertyPath" : "objectAtCurrentIteration.isTweenAnimated",
"oneway" : false
+ },
+ "isClearing" : {
+ "boundObject" : {"@": "tweenRepetition"},
+ "boundObjectPropertyPath" : "objectAtCurrentIteration.isClearing",
+ "oneway" : false
}
}
},
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index a9ee1fec..729abd64 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -118,6 +118,21 @@ var Tween = exports.Tween = Montage.create(Component, {
this.needsDraw = true;
}
},
+
+ _isClearing : {
+ serializable: true,
+ value: false
+ },
+ isClearing : {
+ get: function() {
+ return this._isClearing;
+ },
+ set: function(newVal) {
+ if (newVal === "clear it") {
+ this.eventManager.removeEventListener("elementChange", this, false);
+ }
+ }
+ },
prepareForDraw:{
value:function () {
@@ -141,9 +156,6 @@ var Tween = exports.Tween = Montage.create(Component, {
if (event.detail.source && event.detail.source !== "tween") {
// check for correct element selection
- console.log("handleElementChange! " + this.tweenID)
- console.log(this.application.ninja.selectedElements[0]._element);
- console.log(this.parentComponent.parentComponent.animatedElement);
if (this.application.ninja.selectedElements[0]._element != this.parentComponent.parentComponent.animatedElement) {
alert("Wrong element selected for this keyframe track");
} else {
@@ -165,7 +177,6 @@ var Tween = exports.Tween = Montage.create(Component, {
selectTween:{
value: function(){
// turn on event listener for element change
- console.log('adding elementChange event listener for tween ' + this.tweenID)
this.eventManager.addEventListener("elementChange", this, false);
// select the containing layer
--
cgit v1.2.3
From ad730e448c523b8c849cb1c9c63a30e8b62a2780 Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 08:33:44 -0800
Subject: Fix re-reopened animation duration and milliseconds
Signed-off-by: Jonathan Duran
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 55c84dce..d369106c 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -553,7 +553,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
var keyframeString = "@-webkit-keyframes " + this.animationName + " {";
for (var i = 0; i < this.tweens.length; i++) {
- var keyframePercent = Math.round((this.tweens[i].keyFrameMillisec / this.trackDuration) * 100) + "%";
+ var keyMill = parseInt(this.tweens[i].keyFrameMillisec);
+ var trackDur = parseFloat(this.trackDuration);
+ var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%";
var keyframePropertyString = " " + keyframePercent + " {";
keyframePropertyString += "top: " + this.tweens[i].tweenedProperties["top"] + "px;";
keyframePropertyString += " left: " + this.tweens[i].tweenedProperties["left"] + "px;";
--
cgit v1.2.3
From b301702e2eed93df9124b9f4f9a02fdf36d31dfa Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 08:41:37 -0800
Subject: todo note
Signed-off-by: Jonathan Duran
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index d369106c..d6c1128e 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -554,7 +554,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
for (var i = 0; i < this.tweens.length; i++) {
var keyMill = parseInt(this.tweens[i].keyFrameMillisec);
- var trackDur = parseFloat(this.trackDuration);
+ // TODO - trackDur should be parseFloat rounded to significant digits
+ var trackDur = parseInt(this.trackDuration);
var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%";
var keyframePropertyString = " " + keyframePercent + " {";
keyframePropertyString += "top: " + this.tweens[i].tweenedProperties["top"] + "px;";
--
cgit v1.2.3
From ffe308bc1c876b83a0b24fc1234a16f21a601aa2 Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 09:17:09 -0800
Subject: remove comment
Signed-off-by: Jonathan Duran
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 1 -
1 file changed, 1 deletion(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index d6c1128e..bbf505fc 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -377,7 +377,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
// This needs to move to a keyboard shortcut that is TBD
var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
- //this.application.ninja.timeline.selectLayer(selectIndex);
if (ev.shiftKey) {
if (this.application.ninja.timeline.arrLayers[selectedIndex].elementsList.length == 1) {
--
cgit v1.2.3
From 09d487fb5d28a181f69e3c6afa87d6e2f624317b Mon Sep 17 00:00:00 2001
From: Jonathan Duran
Date: Tue, 28 Feb 2012 10:07:04 -0800
Subject: Fix to animation names to support multiclassed elements
Signed-off-by: Jonathan Duran
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index bbf505fc..43cd7477 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -532,7 +532,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
this.tweens[0].tweenedProperties["top"] = this.animatedElement.offsetTop;
this.tweens[0].tweenedProperties["left"] = this.animatedElement.offsetLeft;
var animationDuration = Math.round(this.trackDuration / 1000) + "s";
- this.animationName = "animation_" + this.animatedElement.className;
+ this.animationName = "animation_" + this.animatedElement.classList[0];
this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", this.animationName);
this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration);
this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", "infinite");
--
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')
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')
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')
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
From 631c9750e5ad6d7739d8683c31aa3a9f8f3b4e4c Mon Sep 17 00:00:00 2001
From: Kruti Shah
Date: Tue, 28 Feb 2012 15:01:41 -0800
Subject: Timeline: Fix Selection , Partially Fix adding element to an already
animated track with one element
Signed-off-by: Kruti Shah
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 27 ++++++++++++++++++----
.../Timeline/TimelineTrack.reel/TimelineTrack.js | 1 +
2 files changed, 23 insertions(+), 5 deletions(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 01b03531..81415951 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -256,6 +256,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
{
this._openDoc=true;
+ this._captureSelection=true;
NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
myIndex++;
}
@@ -579,7 +580,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);
@@ -592,7 +593,7 @@ 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);
}
@@ -722,9 +723,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
handleElementAdded:{
value:function (event) {
+
event.detail.uuid=nj.generateRandom();
- this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
- this.currentLayerSelected.elementsList.push(event.detail);
+ if(this.currentLayerSelected.elementsList[0]!==undefined){
+ if(this.currentTrackSelected.isTrackAnimated){
+ this.application.ninja.stage.clearDrawingCanvas();
+ alert("cannot add elements to a layer with animated element");/* check how to clear the canvas*/
+ return;
+ }else{
+ this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
+ this.currentLayerSelected.elementsList.push(event.detail);
+ }
+ }else{
+ this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
+ this.currentLayerSelected.elementsList.push(event.detail);
+ }
}
},
@@ -948,7 +961,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.currentTrackSelected = this.arrTracks[layerIndex];
if(!this._openDoc){
if(this._captureSelection){
- this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList)
+ if(this.currentLayerSelected.elementsList.length >= 1){
+ this.application.ninja.selectionController.selectElements(this.currentLayerSelected.elementsList);
+ }else{
+ this.application.ninja.selectionController.executeSelectElement();
+ }
}
this._captureSelection = true;
}
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 43cd7477..bf97c0fd 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -519,6 +519,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
i++;
this.nextKeyframe += 1;
}
+ this.isTrackAnimated = true;
}
}
else{
--
cgit v1.2.3
From 38d8d4ea7d033b35f95e38ebb7d6abfd81bd2c69 Mon Sep 17 00:00:00 2001
From: Jon Reid
Date: Wed, 29 Feb 2012 09:56:56 -0800
Subject: Timeline: document switching + new document.
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 98 +++++++++++++++-------
1 file changed, 68 insertions(+), 30 deletions(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 01b03531..6a9e0140 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -28,7 +28,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrLayers = newVal;
- this.application.ninja.currentDocument.tlArrLayers = newVal;
+ this.updateLayers();
}
},
@@ -44,6 +44,18 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this._layerRepetition = newVal;
}
},
+ updateLayers : {
+ value: function() {
+ this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
+ // this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
+ console.log('inside of updateLayers ');
+ console.log(this.application.ninja.currentDocument.tlArrTracks);
+
+ }
+ },
+ boolUpdateLayers : {
+ value: true
+ },
_currentLayerNumber:{
value:0
@@ -100,7 +112,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrTracks = newVal;
- this.application.ninja.currentDocument.tlArrTracks = newVal;
+ this.updateLayers();
}
},
@@ -182,7 +194,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
handleOnOpenDocument:{
value:function(){
+ this.boolUpdateLayers = false;
this.clearTimelinePanel();
+ this.boolUpdateLayers = true;
this.eventManager.addEventListener("deleteLayerClick", this, false);
this.eventManager.addEventListener("newLayer", this, false);
this.eventManager.addEventListener("deleteLayer", this, false);
@@ -204,6 +218,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
handleCloseDocument: {
value: function(event) {
this.clearTimelinePanel();
+ this.arrTracks = [];
+ this.arrLayers = [];
}
},
@@ -245,31 +261,55 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
initTimelineView:{
value:function () {
var myIndex;
-
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") {
+ // No, we have no information stored. Create it.
+ console.log('newfile!')
+ this.application.ninja.currentDocument.isTimelineInitialized = true;
+ this.application.ninja.currentDocument.tlArrLayers = [];
+ this.application.ninja.currentDocument.tlArrTracks = [];
+ _firstLayerDraw = false;
+ if(!this.application.ninja.documentController.creatingNewFile){
+ if(this.application.ninja.currentDocument.documentRoot.children[0]){
+ myIndex=0;
+ while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
+ {
+ this._openDoc=true;
+ NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
+ myIndex++;
+ }
+ }
+ else{
+ NJevent('newLayer', this._hashKey);
+ this.selectLayer(0);
+ }
+ }else{
+ NJevent('newLayer', this._hashKey);
+ this.selectLayer(0);
+
+ }
+ _firstLayerDraw = true;
+ this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
+ } else {
+ // we do have information stored. Use it.
+ console.log('oldfile!')
+ console.log("tlArrLayers: " , this.application.ninja.currentDocument.tlArrLayers);
+ console.log("tlArrTracks: " , this.application.ninja.currentDocument.tlArrTracks);
+ this.arrLayers = this.application.ninja.currentDocument.tlArrLayers;
+ this.arrTracks = this.application.ninja.currentDocument.tlArrTracks;
+ }
+
+ // Redraw all the things
+ this.layerRepetition.needsDraw = true;
+ this.trackRepetition.needsDraw = true;
+ this.needsDraw = true;
- this._hashKey = "123";
- _firstLayerDraw = false;
- if(!this.application.ninja.documentController.creatingNewFile){
- if(this.application.ninja.currentDocument.documentRoot.children[0]){
- myIndex=0;
- while(this.application.ninja.currentDocument.documentRoot.children[myIndex])
- {
- this._openDoc=true;
- NJevent('newLayer',{key:this._hashKey,ele:this.application.ninja.currentDocument.documentRoot.children[myIndex]})
- myIndex++;
- }
- }
- else{
- NJevent('newLayer', this._hashKey);
- this.selectLayer(0);
- }
- }else{
- NJevent('newLayer', this._hashKey);
- this.selectLayer(0);
- }
- _firstLayerDraw = true;
}
},
@@ -299,8 +339,10 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.hashTrackInstance = null;
this.hashLayerNumber = null;
this.hashElementMapToLayer = null;
- this.arrTracks = [];
- this.arrLayers = [];
+ if (!this.boolUpdateLayers) {
+
+ }
+
this.currentLayerNumber = 0;
this.currentLayerSelected = false;
this.currentTrackSelected = false;
@@ -311,10 +353,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.end_hottext.value = 25;
this.updateTrackContainerWidth();
- // Redraw all the things
- this.layerRepetition.needsDraw = true;
- this.trackRepetition.needsDraw = true;
- this.needsDraw = true;
}
},
--
cgit v1.2.3
From 8ccc989388bfbcb0d5713c44b9c97ef5ce45d31c Mon Sep 17 00:00:00 2001
From: Kruti Shah
Date: Wed, 29 Feb 2012 12:30:12 -0800
Subject: Timeline: Changed the variables names to resolve issues.And removed
the alert.
Signed-off-by: Kruti Shah
---
.../Timeline/TimelinePanel.reel/TimelinePanel.js | 4 +-
.../Timeline/TimelineTrack.reel/TimelineTrack.js | 45 ++++++++++------------
2 files changed, 23 insertions(+), 26 deletions(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 81415951..e92c83db 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -728,7 +728,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
if(this.currentLayerSelected.elementsList[0]!==undefined){
if(this.currentTrackSelected.isTrackAnimated){
this.application.ninja.stage.clearDrawingCanvas();
- alert("cannot add elements to a layer with animated element");/* check how to clear the canvas*/
+ console.log("cannot add elements to a layer with animated element");
return;
}else{
this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
@@ -738,12 +738,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this.hashElementMapToLayer.setItem(event.detail.uuid, event.detail,this.currentLayerSelected);
this.currentLayerSelected.elementsList.push(event.detail);
}
-
}
},
handleElementDeleted:{
value:function (event) {
+
var length;
this.deleteElement = event.detail;
length = this.currentLayerSelected.elementsList.length - 1;
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index bf97c0fd..a2aaa550 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -459,7 +459,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
retrieveStoredTweens:{
value:function () {
- var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0;
+ var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute
+ var animationTiming,trackTiming,currentMilliSec,currentMilliSecPerPixel,clickPosition,i = 0;
var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
this.application.ninja.timeline.arrLayers[selectedIndex].created=true;
@@ -467,23 +468,23 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
if(this.animatedElement!==undefined){
this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name");
if(this.animationName){
- this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration");
- this.trackDuration = this.animationDuration.split("s");
- this.currentMilliSec = this.trackDuration[0] * 1000;
- this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
- this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
+ animationTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration");
+ trackTiming = animationTiming.split("s");
+ currentMilliSec = trackTiming[0] * 1000;
+ currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
+ clickPosition = currentMilliSec / currentMilliSecPerPixel;
this.nextKeyframe = 0;
this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
- while (this.currentKeyframeRule[i]) {
+ for (i =0; this.currentKeyframeRule[i] ;i++) {
var newTween = {};
offsetAttribute = this.currentKeyframeRule[i].cssText.split(" ");
topOffSetAttribute = offsetAttribute[3].split("px");
leftOffsetAttribute = offsetAttribute[5].split("px");
- parseInt(topOffSetAttribute[0]);
- parseInt(leftOffsetAttribute[0]);
+ var tempTopOffset = parseInt(topOffSetAttribute[0]);
+ var tempLeftOffset =parseInt(leftOffsetAttribute[0]);
if (this.currentKeyframeRule[i].keyText === "0%") {
newTween.spanWidth = 0;
@@ -492,8 +493,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
newTween.tweenID = 0;
newTween.spanPosition = 0;
newTween.tweenedProperties = [];
- newTween.tweenedProperties["top"] = topOffSetAttribute[0];
- newTween.tweenedProperties["left"] = leftOffsetAttribute[0];
+ newTween.tweenedProperties["top"] = tempTopOffset;
+ newTween.tweenedProperties["left"] = tempLeftOffset;
this.tweens.push(newTween);
}
@@ -501,30 +502,26 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
percentValue = this.currentKeyframeRule[i].keyText;
splitValue = percentValue.split("%");
fraction = splitValue[0] / 100;
- this.currentMilliSec = fraction * this.trackDuration[0] * 1000;
- this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
- this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
- newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition;
- newTween.keyFramePosition = this.clickPos;
- newTween.keyFrameMillisec = this.currentMilliSec;
+ currentMilliSec = fraction * trackTiming[0] * 1000;
+ currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
+ clickPosition = currentMilliSec / currentMilliSecPerPixel;
+ newTween.spanWidth = clickPosition - this.tweens[this.tweens.length - 1].keyFramePosition;
+ newTween.keyFramePosition = clickPosition;
+ newTween.keyFrameMillisec = currentMilliSec;
newTween.tweenID = this.nextKeyframe;
- newTween.spanPosition = this.clickPos - newTween.spanWidth;
+ newTween.spanPosition =clickPosition - newTween.spanWidth;
newTween.tweenedProperties=[];
- newTween.tweenedProperties["top"] = topOffSetAttribute[0];
- newTween.tweenedProperties["left"] = leftOffsetAttribute[0];
+ newTween.tweenedProperties["top"] = tempTopOffset;
+ newTween.tweenedProperties["left"] = tempLeftOffset;
this.tweens.push(newTween);
}
- i++;
this.nextKeyframe += 1;
}
this.isTrackAnimated = true;
}
}
- else{
- return;
- }
}
},
--
cgit v1.2.3
From 6e28beaca4ebc740fdc637d65f0b966c59fd05d2 Mon Sep 17 00:00:00 2001
From: Kruti Shah
Date: Wed, 29 Feb 2012 12:36:46 -0800
Subject: TImeline: Cleanup
Signed-off-by: Kruti Shah
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index a2aaa550..7394d42e 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -476,7 +476,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
this.nextKeyframe = 0;
this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
- for (i =0; this.currentKeyframeRule[i] ;i++) {
+ var currentKeyFrameRuleLength = this.currentKeyframeRule.length;
+
+ for (i =0; i
---
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
(limited to 'js/panels/Timeline')
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 7394d42e..f8f4f6b8 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -476,9 +476,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
this.nextKeyframe = 0;
this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
- var currentKeyFrameRuleLength = this.currentKeyframeRule.length;
-
- for (i =0; i
-
Master Layer
+
Master Layer
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 67ff3c02..6d23453d 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -28,7 +28,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrLayers = newVal;
- this.updateLayers();
+ this._cacheArrays();
}
},
@@ -44,16 +44,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
this._layerRepetition = newVal;
}
},
- updateLayers : {
+ _cacheArrays : {
value: function() {
- this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
- // this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
- console.log('inside of updateLayers ');
- console.log(this.application.ninja.currentDocument.tlArrTracks);
-
+ // Cache this.arrLayers and this.arrTracks.
+ console.log('cacheArrays ' + this._boolCacheArrays)
+ if (this._boolCacheArrays) {
+ console.log('caching arrays for ', this.application.ninja.currentDocument.name);
+ this.application.ninja.currentDocument.tlArrLayers = this.arrLayers;
+ this.application.ninja.currentDocument.tlArrTracks = this.arrTracks;
+ }
}
},
- boolUpdateLayers : {
+
+ // Set to false to skip array caching array sets in current document
+ _boolCacheArrays : {
value: true
},
@@ -112,7 +116,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
},
set:function (newVal) {
this._arrTracks = newVal;
- this.updateLayers();
+ this._cacheArrays();
}
},
@@ -192,43 +196,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
}
},
- handleOnOpenDocument:{
- value:function(){
- this.boolUpdateLayers = false;
- this.clearTimelinePanel();
- this.boolUpdateLayers = true;
- this.eventManager.addEventListener("deleteLayerClick", this, false);
- this.eventManager.addEventListener("newLayer", this, false);
- this.eventManager.addEventListener("deleteLayer", this, false);
- this.eventManager.addEventListener("layerBinding", this, false);
- this.eventManager.addEventListener("elementAdded", this, false);
- this.eventManager.addEventListener("elementDeleted", this, false);
- this.eventManager.addEventListener("deleteSelection", this, false);
- this.eventManager.addEventListener("selectionChange", this, true);
- this.hashInstance = this.createLayerHashT