diff options
author | Jon Reid | 2012-05-18 15:22:20 -0700 |
---|---|---|
committer | Jon Reid | 2012-05-18 15:22:20 -0700 |
commit | e7286bcbd82c944ffe9705d87ff23b9ea29ea7e5 (patch) | |
tree | a27d78b2c79bc78afce55320cdb7598fd4571c94 | |
parent | 6c4f58ab9dd2f60d509d3e1c1ba0c94a6995691d (diff) | |
download | ninja-e7286bcbd82c944ffe9705d87ff23b9ea29ea7e5.tar.gz |
Timeline: Bug fixes for deleting elements.
-rwxr-xr-x | js/controllers/elements/element-controller.js | 12 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 925fc959..675176e9 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -13,22 +13,14 @@ exports.ElementController = Montage.create(Component, { | |||
13 | value: function(el, styles) { | 13 | value: function(el, styles) { |
14 | // Updated to use new methods in TimelinePanel. JR. | 14 | // Updated to use new methods in TimelinePanel. JR. |
15 | var insertionIndex = this.application.ninja.timeline.getInsertionIndex(); | 15 | var insertionIndex = this.application.ninja.timeline.getInsertionIndex(); |
16 | console.log("elementcontroller.addElement, insertionIndex = ", insertionIndex); | ||
17 | //debugger; | ||
18 | if (insertionIndex === false) { | 16 | if (insertionIndex === false) { |
19 | this.application.ninja.currentSelectedContainer.appendChild(el); | 17 | this.application.ninja.currentSelectedContainer.appendChild(el); |
20 | } else { | 18 | } else { |
21 | if (insertionIndex === 0) { | 19 | if (insertionIndex === 0) { |
22 | this.application.ninja.currentSelectedContainer.appendChild(el); | 20 | this.application.ninja.currentSelectedContainer.appendChild(el); |
23 | } else { | 21 | } else { |
24 | /* | 22 | var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement; |
25 | if (insertionIndex === this.application.ninja.timeline.arrLayers.length-1) { | 23 | element.parentNode.insertBefore(el, element.nextSibling); |
26 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
27 | } else { | ||
28 | */ | ||
29 | var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement; | ||
30 | element.parentNode.insertBefore(el, element.nextSibling); | ||
31 | //} | ||
32 | } | 24 | } |
33 | } | 25 | } |
34 | 26 | ||
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 6155ce3b..43ffaab2 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -1239,6 +1239,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
1239 | for (j = 0; j < arrLayersLength; j++) { | 1239 | for (j = 0; j < arrLayersLength; j++) { |
1240 | if (this.arrLayers[j].layerData.stageElement == currentTest) { | 1240 | if (this.arrLayers[j].layerData.stageElement == currentTest) { |
1241 | this.arrLayers.splice(j, 1); | 1241 | this.arrLayers.splice(j, 1); |
1242 | // Super-secret magic trick: Now that we've spliced out an element, | ||
1243 | // arrLayers.length is different. We need to update it. | ||
1244 | arrLayersLength = this.arrLayers.length; | ||
1242 | } | 1245 | } |
1243 | } | 1246 | } |
1244 | } | 1247 | } |