From 32257ac142f872d3c1f6c07504bae77ae884ed93 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 11 May 2012 02:34:26 -0700 Subject: Fix a bug in span splitting interaction and remove console logs Signed-off-by: Jonathan Duran --- js/panels/Timeline/Keyframe.reel/Keyframe.js | 5 ----- js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 8 ++++---- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 17 ++++++++++------- 3 files changed, 14 insertions(+), 16 deletions(-) (limited to 'js/panels/Timeline') diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index e5fa71d3..2d3ab72f 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js @@ -37,11 +37,6 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { this.element.addEventListener("mouseout", this.handleMouseout.bind(this), false); this.element.addEventListener("dragstart", this.handleDragstart.bind(this), false); this.element.addEventListener("dragend", this.handleDragend.bind(this), false); - - - - - } }, diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 53b7bd5e..690c912b 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js @@ -154,7 +154,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { handleClick:{ value:function(ev){ if (ev.shiftKey) { - console.log(this.trackType); + if (this.propTweens.length < 1) { // check if there is an editor property assigned yet @@ -170,8 +170,8 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { console.log("Property track editorProperty set to: " + this.trackEditorProperty); } } else if (this.trackType === "position") { - console.log("clicking on position track"); - console.log(this.trackEditorProperty); + //console.log("clicking on position track"); + //console.log(this.trackEditorProperty); } this.insertPropTween(0); @@ -239,7 +239,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { value:function(tweenEvent){ this.insertPropTween(tweenEvent.offsetX); this.animationName = this.parentComponent.parentComponent.parentComponent.animationName; - console.log(this.animationName); + //console.log(this.animationName); } } }); diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 35440cc4..1731213b 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -617,6 +617,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this.application.ninja.timeline.selectLayer(selectedIndex, false); this.insertTween(ev.offsetX); } else { + console.log(ev.target); this.splitTween(ev); } } @@ -671,7 +672,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { splitTween:{ value:function (ev) { - console.log("Splitting an existing span with a new keyframe."); var clickPos = ev.target.parentElement.offsetLeft + ev.offsetX; var i; var tweensLength = this.tweens.length-1; @@ -680,14 +680,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { prevTween = this.tweens[i].tweenData.keyFramePosition; nextTween = this.tweens[i+1].tweenData.keyFramePosition; if(clickPos > prevTween && clickPos < nextTween){ - console.log(clickPos + " found on tween: "+ this.tweens[i+1].tweenData.tweenID); + //console.log(clickPos + " found on tween: "+ this.tweens[i+1].tweenData.tweenID); splitTweenIndex = this.tweens[i+1].tweenData.tweenID; this.tweens[i+1].tweenData.spanWidth = this.tweens[i+1].tweenData.keyFramePosition - clickPos; this.tweens[i+1].tweenData.spanPosition = ev.target.parentElement.offsetLeft + ev.offsetX; - ev.target.style.width = this.tweens[i+1].tweenData.spanWidth + "px"; - ev.target.parentElement.style.left = clickPos + "px"; - ev.target.parentElement.children[1].style.left = (this.tweens[i+1].tweenData.spanWidth - 3) + "px"; - + if (ev.target.className != "tween-span") { + // don't set styles on timeline track if event is coming from the track + } else { + ev.target.style.width = this.tweens[i + 1].tweenData.spanWidth + "px"; + ev.target.parentElement.style.left = clickPos + "px"; + ev.target.parentElement.children[1].style.left = (this.tweens[i + 1].tweenData.spanWidth - 3) + "px"; + } var newTweenToInsert = {}; newTweenToInsert.tweenData = {}; newTweenToInsert.tweenData.spanWidth = clickPos - prevTween; @@ -701,9 +704,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { newTweenToInsert.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth; newTweenToInsert.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight; this.tweens.splice(splitTweenIndex, 0, newTweenToInsert); + break; } } - this.application.ninja.documentController.activeDocument.needsSave = true; } }, -- cgit v1.2.3