From ec5f81c6c0ccf865505ab82ebf9240c667f05c91 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 27 Feb 2012 12:07:30 -0800 Subject: Timeline: further work on clearTimeline method. --- .../Timeline/TimelinePanel.reel/TimelinePanel.html | 5 +++-- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html index 9d0b8210..65d2fa7b 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html @@ -32,7 +32,8 @@ "timetext" : {"#": "time_text"}, "timebar" : {"#": "time_bar"}, "container_tracks" : {"#" : "container-tracks"}, - "end_hottext" : {"@" : "endHottext"} + "end_hottext" : {"@" : "endHottext"}, + "getme" : {"#" : "getme"} } }, @@ -284,7 +285,7 @@
-
Master Layer
+
Master Layer
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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 5ab7efb9949e486395659c383064a08821febdae Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:15:27 -0800 Subject: persist selections while switching documents Signed-off-by: Ananya Sen --- js/panels/properties/content.reel/content.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/panels') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..9b9b7108 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -55,6 +55,7 @@ exports.Content = Montage.create(Component, { } this.eventManager.addEventListener("openDocument", this, false); + this.eventManager.addEventListener("switchDocument", this, false); } }, @@ -74,6 +75,15 @@ exports.Content = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function(){ + // For now always assume that the stage is selected by default + if(this.application.ninja.selectedElements.length === 0) { + this.displayStageProperties(); + } + } + }, + /** * Blur and Key up to handle change in the Element ID field. */ -- cgit v1.2.3 From 557c4d3100ccde51b925b71f0650b2c783a4a042 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 16:02:15 -0800 Subject: minor fix for handling selections on switch document Signed-off-by: Ananya Sen --- js/panels/properties/content.reel/content.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/panels') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 9b9b7108..cc9ec96a 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -80,6 +80,12 @@ exports.Content = Montage.create(Component, { // For now always assume that the stage is selected by default if(this.application.ninja.selectedElements.length === 0) { this.displayStageProperties(); + }else { + if(this.application.ninja.selectedElements.length === 1) { + this.displayElementProperties(this.application.ninja.selectedElements[0]._element); + } else { + this.displayGroupProperties(this.application.ninja.selectedElements); + } } } }, -- cgit v1.2.3 From 3dbe798285f95dc63ae33739df5daadb8c432f24 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 28 Feb 2012 16:20:25 -0800 Subject: putting the color panel on top when opening ninja Signed-off-by: Valerio Virgillito --- js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/panels') diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js index 3cbd4369..003724bb 100755 --- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js @@ -45,7 +45,7 @@ exports.PanelContainer = Montage.create(Component, { }, initPanelOrder: { - value: ['PropertiesPanel','ColorPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel','PresetsPanel'] + value: ['ColorPanel', 'PropertiesPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel','PresetsPanel'] }, panelOrder: { -- cgit v1.2.3 From 209e0781e926212bbaaad9e8ca4b61a0c389b30f Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 28 Feb 2012 17:19:42 -0800 Subject: We need to remove color buttons from the color model when updating the PI for selection change. Signed-off-by: Nivesh Rajbhandari --- js/panels/properties/content.reel/content.js | 22 ++++++++++++++++++++++ .../color-select.reel/color-select.html | 4 +++- .../custom-rows/color-select.reel/color-select.js | 21 +++++++++++++++++++++ .../properties/sections/custom.reel/custom.js | 5 +++++ 4 files changed, 51 insertions(+), 1 deletion(-) (limited to 'js/panels') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..58c37db4 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -156,6 +156,17 @@ exports.Content = Montage.create(Component, { this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); if(this.customPi !== stage.elementModel.pi) { + // We need to unregister color chips from the previous selection from the Color Model + var len = this.customSections.length; + for(var n = 0, controls; n < len; n++) { + controls = this.customSections[n].content.controls; + if(controls["colorSelect"]) { + controls["colorSelect"].destroy(); + } else if(controls["stageBackground"]) { + controls["stageBackground"].destroy(); + } + } + this.customPi = stage.elementModel.pi; this.displayCustomProperties(stage, stage.elementModel.pi); } @@ -221,6 +232,17 @@ exports.Content = Montage.create(Component, { // Custom Section if(this.customPi !== el.elementModel.pi) { + // We need to unregister color chips from the previous selection from the Color Model + var len = this.customSections.length; + for(var n = 0, controls; n < len; n++) { + controls = this.customSections[n].content.controls; + if(controls["colorSelect"]) { + controls["colorSelect"].destroy(); + } else if(controls["stageBackground"]) { + controls["stageBackground"].destroy(); + } + } + this.customPi = el.elementModel.pi; this.displayCustomProperties(el, el.elementModel.pi); } diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html index 9c2588b9..96cc4de7 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html @@ -14,7 +14,9 @@ "properties" : { "element" : {"#": "section"}, "Stroke" : {"#": "Stroke"}, - "Fill" : {"#": "Fill"} + "Fill" : {"#": "Fill"}, + "strokeChip" : {"@": "colorChip"}, + "fillChip" : {"@": "colorChip2"} } }, diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js index 60f8efef..3e81ff67 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js @@ -17,6 +17,14 @@ exports.ColorSelect = Montage.create(Component, { value: null }, + strokeChip: { + value: null + }, + + fillChip: { + value: null + }, + handleChange: { value: function(e) { @@ -57,6 +65,19 @@ exports.ColorSelect = Montage.create(Component, { // } } + }, + + destroy: { + value: function() { + if(this.strokeChip) + { + this.strokeChip.destroy(); + } + if(this.fillChip) + { + this.fillChip.destroy(); + } + } } }); \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index a2b9b9fa..a537d323 100755 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -59,6 +59,8 @@ exports.CustomSection = Montage.create(Component, { if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["colorSelect"] = tmpRow; } else { @@ -344,6 +346,9 @@ exports.CustomSection = Montage.create(Component, { this.controls[aField.id] = obj; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["stageBackground"] = obj; + return obj; } } -- 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') 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 31dc61a626ee9f2b08cb098a51ca0fed5bf30e77 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 29 Feb 2012 11:21:22 -0800 Subject: Squashed commit of the following: commit 3dbe798285f95dc63ae33739df5daadb8c432f24 Author: Valerio Virgillito Date: Tue Feb 28 16:20:25 2012 -0800 putting the color panel on top when opening ninja Signed-off-by: Valerio Virgillito commit b5ae7f0babb185051242df47634e24ad7a68f60e Merge: 20d4f1d 2bc8343 Author: Valerio Virgillito Date: Tue Feb 28 16:15:44 2012 -0800 Merge branch 'nested-selection' of https://github.com/mencio/ninja-internal into integration-candidate Conflicts: js/ninja.reel/ninja.html Signed-off-by: Valerio Virgillito commit 2bc834334a3197ab7cffacc7332eafd1b52443d1 Author: Valerio Virgillito Date: Tue Feb 28 16:11:42 2012 -0800 revert changes to the timeline Signed-off-by: Valerio Virgillito commit ae96ea66acc4be873fb7fb73fb3f4484b6db3eb8 Author: Valerio Virgillito Date: Tue Feb 28 16:03:32 2012 -0800 adding some margin to the bread crumb buttons Signed-off-by: Valerio Virgillito commit 20d4f1d703c004dd7f869576b6c471b3fb5b5d3e Merge: ee52f19 557c4d3 Author: Valerio Virgillito Date: Tue Feb 28 16:02:37 2012 -0800 Merge pull request #81 from ananyasen/integration-candidate persist selections while switching documents commit 557c4d3100ccde51b925b71f0650b2c783a4a042 Author: Ananya Sen Date: Tue Feb 28 16:02:15 2012 -0800 minor fix for handling selections on switch document Signed-off-by: Ananya Sen commit a230f0cd065613a1bc933e3d6d3f7e77f52bec04 Author: Ananya Sen Date: Tue Feb 28 15:48:55 2012 -0800 selection controller sets _isDocument = true if number of selections are 0, on switch document Signed-off-by: Ananya Sen commit ee52f197d1eb53a5ff30b54b8df1d2b53014eb0e Merge: 8e370cc da83f44 Author: Valerio Virgillito Date: Tue Feb 28 15:16:12 2012 -0800 Merge pull request #80 from joseeight/FileIO-Build-Candidate Adding CSS attributes support to I/O commit 5ab7efb9949e486395659c383064a08821febdae Author: Ananya Sen Date: Tue Feb 28 15:15:27 2012 -0800 persist selections while switching documents Signed-off-by: Ananya Sen commit da83f44b0ecf379b0950a88d1c378fbedb80e386 Merge: b799b7c 676b4e2 Author: Jose Antonio Marquez Date: Tue Feb 28 15:15:12 2012 -0800 Merge branch 'refs/heads/integration-candidate' into FileIO-Build-Candidate commit 8e370cc72aa85de594a5d55ae89947a70af414ca Merge: 8de4002 676b4e2 Author: Valerio Virgillito Date: Tue Feb 28 15:08:48 2012 -0800 Merge branch 'integration-candidate' of github.com:Motorola-Mobility/ninja-internal into integration-candidate commit 8de40029442333114d81ac30a8886a995a3dc56b Merge: b0b4d64 eb27ed3 Author: Valerio Virgillito Date: Tue Feb 28 15:08:18 2012 -0800 Merge branch 'ToolFixes' of https://github.com/mqg734/ninja-internal into integration-candidate commit eb27ed35bf282262843de13b00af89a2bceac53f Merge: ea59626 7c9291a Author: Nivesh Rajbhandari Date: Tue Feb 28 15:04:33 2012 -0800 Merge branch 'refs/heads/ninja-internal' into ToolFixes commit b799b7cf3a422f407045c52a4c6a61756d1ea096 Merge: f7c08fe 2ce9f65 Author: Jose Antonio Marquez Date: Tue Feb 28 15:03:38 2012 -0800 Merge branch 'refs/heads/FileIO' into FileIO-Build-Candidate commit 2ce9f65c3a34937928f08690606962af3085c74f Author: Jose Antonio Marquez Date: Tue Feb 28 15:03:23 2012 -0800 CSS attributes Setting up logic to include attributes in for the