From d343c7b3f482c17176cca3ddb6e7f8753169ad48 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Mon, 9 Apr 2012 15:15:59 -0700 Subject: Timeline: Bug fix, IKNINJA 1467, "Timeline: Changing layer names should not require hitting "Return" key to commit the change" --- js/components/editable.reel/editable.js | 7 +++++++ js/panels/Timeline/Layer.reel/Layer.js | 7 ++++--- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/components/editable.reel/editable.js b/js/components/editable.reel/editable.js index 7a31e7fd..ca65bc2a 100644 --- a/js/components/editable.reel/editable.js +++ b/js/components/editable.reel/editable.js @@ -115,6 +115,9 @@ exports.Editable = Montage.create(Component, { ///// Save the preEditValue this._preEditValue = this.value; + // Initialize enteredValue with current value + this.enteredValue = this.value; + if(this.selectOnStart) { this.selectAll(); } @@ -189,6 +192,10 @@ exports.Editable = Montage.create(Component, { handleKeydown : { value : function(e) { var k = e.keyCode; + + // Record change + this.enteredValue = this._element.firstChild.data; + //console.log('keyCode: ' + k); } }, diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 3bcc1401..f9edfca6 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -710,13 +710,14 @@ var Layer = exports.Layer = Montage.create(Component, { handleSelectorEditableBlur : { value: function(event) { this.titleSelector.scrollLeft = 0; + this.handleSelectorEditableChange(event); } }, handleSelectorEditableChange: { value: function(event) { - var newVal = "ONTD"; - if (this._layerEditable.value !== "") { - newVal = this._layerEditable.value; + var newVal = this._layerEditable.enteredValue; + if (this._layerEditable.enteredValue.length === 0) { + newVal = this._layerEditable._preEditValue; } this.dynamicLayerName.value = newVal; this.layerName = newVal; diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 20e217e9..8fec1d7d 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -363,6 +363,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { draw: { value: function() { + + // Drag and Drop: // Do we have a helper to append? if (this._appendHelper === true) { @@ -664,6 +666,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { value:function () { this.user_layers.scrollTop = this.layout_tracks.scrollTop; this.layout_markers.scrollLeft = this.layout_tracks.scrollLeft; + this.playheadmarker.style.top = this.layout_tracks.scrollTop + "px"; } }, @@ -684,6 +687,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { var clickedPosition = event.target.offsetLeft + event.offsetX; this.playhead.style.left = (clickedPosition - 2) + "px"; this.playheadmarker.style.left = clickedPosition + "px"; + + + var currentMillisecPerPixel = Math.floor(this.millisecondsOffset / 80); var currentMillisec = currentMillisecPerPixel * clickedPosition; this.updateTimeText(currentMillisec); -- cgit v1.2.3