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/Timeline') 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/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