From f9c592ac8284cace4daed6f2ac87fe15dfad873c Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Tue, 3 Jul 2012 12:47:26 -0700 Subject: Refactoring PropertyTrack.js & Span.js Signed-off-by: Kruti Shah --- js/panels/Timeline/Span.reel/Span.js | 45 ++++++++++-------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) (limited to 'js/panels/Timeline/Span.reel/Span.js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index 3c491a53..51b9a4ce 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -71,9 +71,10 @@ var Span = exports.Span = Montage.create(Component, { newVal = "none"; } this._easing = newVal; - this.parentComponent.easing = this.easing; - this.parentComponent.tweenData.easing = this.easing; - this.parentComponent.setKeyframeEase(newVal); + this.parentTween = this.parentComponent; + this.parentTween.easing = this.easing; + this.parentTween.tweenData.easing = this.easing; + this.parentTween.setKeyframeEase(newVal); this.needsDraw = true; } } @@ -88,11 +89,11 @@ var Span = exports.Span = Montage.create(Component, { draw:{ value: function(){ + var containerWidth , choiceWidth; this.element.style.width = this.spanWidth + "px"; if ((this.spanWidth <= 70) && (this.spanWidth >0)) { - var containerWidth = this.spanWidth -18, - choiceWidth; + containerWidth = this.spanWidth -18 if (containerWidth < 0) { containerWidth = 0; } @@ -109,23 +110,12 @@ var Span = exports.Span = Montage.create(Component, { this.easing_choice.setAttribute("style", ""); } - // Highlight the span? if (this.isHighlighted === true) { this.element.classList.add("spanHighlight"); } else { this.element.classList.remove("spanHighlight"); } - - /* - // Hide or show the choices menu? - if (this.areChoicesVisible === true) { - this.easing_choices.style.display = "block"; - } else { - this.easing_choices.style.display = "none"; - } - */ - - // Change easing? + if (this.easing_choice.innerText !== this.easing) { this.easing_choice.innerText = this.easing; } @@ -137,23 +127,19 @@ var Span = exports.Span = Montage.create(Component, { init: { value: function() { this.easing_choice.addEventListener("click", this.handleEasingChoiceClick.bind(this), false); - //this.easing_choices.addEventListener("click", this.handleEasingChoicesClick.bind(this), false); - } }, highlightSpan:{ value: function(){ - // Class add/remove should only be done in draw cycle. - // this.element.classList.add("spanHighlight"); this.isHighlighted = true; } }, handleEasingChoiceClick: { value: function(event) { + var objPos; event.stopPropagation(); - //this.areChoicesVisible = true; this.application.ninja.timeline.easingMenu.anchor = this.easing_choice; this.application.ninja.timeline.easingMenu.currentChoice = event.currentTarget.innerText; @@ -172,7 +158,7 @@ var Span = exports.Span = Montage.create(Component, { } return objReturn; } - var objPos = findPos(event.target); + objPos = findPos(event.target); this.application.ninja.timeline.easingMenu.top = objPos.top +38 - (this.application.ninja.timeline.layout_tracks.scrollTop); this.application.ninja.timeline.easingMenu.left = objPos.left+18 - (this.application.ninja.timeline.layout_tracks.scrollLeft); this.application.ninja.timeline.easingMenu.show(); @@ -182,29 +168,22 @@ var Span = exports.Span = Montage.create(Component, { handleEasingChoicesClick: { value: function(event) { event.stopPropagation(); - - // Remove the pointer to ourselves - //this.application.ninja.timeline.currentOpenSpanMenu = false; - // Un-highlight the old choice and highlight the new choice this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected"); event.target.classList.add("easing-selected"); // Set the easing this.easing = event.target.dataset.ninjaEase; - this.parentComponent.easing = this.easing; - this.parentComponent.tweenData.easing = this.easing; + this.parentTween.easing = this.easing; + this.parentTween.tweenData.easing = this.easing; // Unbind the event handler this.application.ninja.timeline.easingMenu.popup.contentEl.removeEventListener("click"); - - // Hide the menu. - this.hideEasingMenu(); + this.hideEasingMenu(); } }, hideEasingMenu: { value: function() { - //this.areChoicesVisible = false; this.application.ninja.timeline.easingMenu.hide(); } } -- cgit v1.2.3 From 14f30bb927f2cb4a27c81fd6ee4e8d9af46b4404 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Tue, 3 Jul 2012 15:10:45 -0700 Subject: Refactor Code + Bug Fix for the Colorchip disappear between breadcrumb navigation Signed-off-by: Kruti Shah --- js/panels/Timeline/Span.reel/Span.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/panels/Timeline/Span.reel/Span.js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index 51b9a4ce..f588a0eb 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -177,7 +177,6 @@ var Span = exports.Span = Montage.create(Component, { this.parentTween.easing = this.easing; this.parentTween.tweenData.easing = this.easing; - // Unbind the event handler this.application.ninja.timeline.easingMenu.popup.contentEl.removeEventListener("click"); this.hideEasingMenu(); } -- cgit v1.2.3 From 8a2a9cf8d43a1ba7e40c41619e7db9675f4cb195 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Mon, 9 Jul 2012 10:53:35 -0700 Subject: Refactoring Code Signed-off-by: Kruti Shah --- js/panels/Timeline/Span.reel/Span.js | 43 +++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'js/panels/Timeline/Span.reel/Span.js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index f588a0eb..ffe7f4a4 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -13,7 +13,7 @@ var Span = exports.Span = Montage.create(Component, { value: true }, - // BEGIN: Models + /* Begin: Models */ _spanWidth:{ value:0 }, @@ -79,8 +79,10 @@ var Span = exports.Span = Montage.create(Component, { } } }, + + /* End: Models */ - // BEGIN: draw cycle + /* Begin: Draw Cycle */ prepareForDraw: { value: function() { this.init(); @@ -89,7 +91,9 @@ var Span = exports.Span = Montage.create(Component, { draw:{ value: function(){ - var containerWidth , choiceWidth; + var containerWidth , + choiceWidth; + this.element.style.width = this.spanWidth + "px"; if ((this.spanWidth <= 70) && (this.spanWidth >0)) { @@ -123,18 +127,9 @@ var Span = exports.Span = Montage.create(Component, { } }, - // BEGIN: Controllers - init: { - value: function() { - this.easing_choice.addEventListener("click", this.handleEasingChoiceClick.bind(this), false); - } - }, - - highlightSpan:{ - value: function(){ - this.isHighlighted = true; - } - }, + /* End: Draw Cycle */ + + /* Begin : Event Handlers */ handleEasingChoiceClick: { value: function(event) { @@ -181,9 +176,27 @@ var Span = exports.Span = Montage.create(Component, { this.hideEasingMenu(); } }, + + /* End : Event Handlers */ + + /* Begin: Controllers */ + init: { + value: function() { + this.easing_choice.addEventListener("click", this.handleEasingChoiceClick.bind(this), false); + } + }, + + highlightSpan:{ + value: function(){ + this.isHighlighted = true; + } + }, + hideEasingMenu: { value: function() { this.application.ninja.timeline.easingMenu.hide(); } } + + /* End : Controllers */ }); -- cgit v1.2.3 From 6e29c88846e12757f127f0ce8e8cbb737ab8c880 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Mon, 9 Jul 2012 11:14:55 -0700 Subject: Adding comments Signed-off-by: Kruti Shah --- js/panels/Timeline/Span.reel/Span.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/panels/Timeline/Span.reel/Span.js') diff --git a/js/panels/Timeline/Span.reel/Span.js b/js/panels/Timeline/Span.reel/Span.js index ffe7f4a4..ee3bcb0b 100644 --- a/js/panels/Timeline/Span.reel/Span.js +++ b/js/panels/Timeline/Span.reel/Span.js @@ -163,11 +163,12 @@ var Span = exports.Span = Montage.create(Component, { handleEasingChoicesClick: { value: function(event) { event.stopPropagation(); - + + /* Un-highlight the old choice and highlight the new choice */ this.application.ninja.timeline.easingMenu.popup.contentEl.querySelector(".easing-selected").classList.remove("easing-selected"); event.target.classList.add("easing-selected"); - // Set the easing + /* Set the easing */ this.easing = event.target.dataset.ninjaEase; this.parentTween.easing = this.easing; this.parentTween.tweenData.easing = this.easing; -- cgit v1.2.3