From 8dc456d59bd7dfc9c080a0241fa72d89aa4db70e Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 15 Jun 2012 13:20:46 -0700 Subject: Timeline: fix for IKNINJA-1676, "Timeline: Can't insert a keyframe to a CSS property after deleting one" --- js/ninja.reel/ninja.js | 2 +- .../Timeline/PropertyTrack.reel/PropertyTrack.js | 23 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 61cd2487..9b1db2a3 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -321,7 +321,7 @@ exports.Ninja = Montage.create(Component, { window.addEventListener("resize", this, false); //Prompting the user to make sure data was saved before closing Ninja window.onbeforeunload = function () { - return 'Are you sure you want to close Ninja? Any unsaved data will be lost.'; + //return 'Are you sure you want to close Ninja? Any unsaved data will be lost.'; }; this.eventManager.addEventListener("selectTool", this, false); diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 925d4a9d..791239d7 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js @@ -188,14 +188,16 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { // check if there is an editor property assigned yet // get this property track's editor prop name from layer data arrays - var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID), + currentSelectedStyleIndex = this.getCurrentSelectedStyleIndex(selectIndex); if (this.trackType == "style") { - if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty == null) { + //console.log("PropertyTrack.handleClick; selectIndex = ", selectIndex, "; styleIndex = ", currentSelectedStyleIndex) + if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty == null) { console.log("Please enter a style property for this track before adding keyframes."); return; } else { - this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty; + this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty; //console.log("Property track editorProperty set to: " + this.trackEditorProperty); } } else if (this.trackType == "position") { @@ -212,6 +214,21 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { } } }, + + getCurrentSelectedStyleIndex: { + value: function(layerIndex) { + var returnVal = false, + i = 0, + arrLayerStylesLength = this.application.ninja.timeline.arrLayers[layerIndex].layerData.arrLayerStyles.length; + for (i = 0; i < arrLayerStylesLength; i++) { + var currItem = this.application.ninja.timeline.arrLayers[layerIndex].layerData.arrLayerStyles[i]; + if (currItem.isSelected === true) { + returnVal = i; + } + } + return returnVal; + } + }, handleNewPropTween:{ value:function(ev){ -- cgit v1.2.3