diff options
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 01e132d7..53588f68 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -14,13 +14,32 @@ exports.ElementController = Montage.create(Component, { | |||
14 | 14 | ||
15 | if (el.getAttribute) el.setAttribute('data-ninja-node', 'true'); | 15 | if (el.getAttribute) el.setAttribute('data-ninja-node', 'true'); |
16 | 16 | ||
17 | // Updated to use new methods in TimelinePanel. JR. | ||
18 | var insertionIndex = this.application.ninja.timeline.getInsertionIndex(); | ||
19 | if (insertionIndex === false) { | ||
20 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
21 | } else { | ||
22 | if (insertionIndex === 0) { | ||
23 | this.application.ninja.currentSelectedContainer.appendChild(el); | ||
24 | } else { | ||
25 | var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement; | ||
26 | element.parentNode.insertBefore(el, element.nextSibling); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | if(styles) { | ||
31 | this.application.ninja.stylesController.setElementStyles(el, styles); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | // Old methods. Kept for reference. Delete if not needed. JR. | ||
17 | if(this.application.ninja.timeline.currentLayerSelected) { | 36 | if(this.application.ninja.timeline.currentLayerSelected) { |
18 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); | 37 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); |
19 | 38 | ||
20 | if(selectedLayerIndex === 0) { | 39 | if(selectedLayerIndex === 0) { |
21 | this.application.ninja.currentSelectedContainer.appendChild(el); | 40 | this.application.ninja.currentSelectedContainer.appendChild(el); |
22 | } else { | 41 | } else { |
23 | var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; | 42 | var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.stageElement; |
24 | element.parentNode.insertBefore(el, element.nextSibling); | 43 | element.parentNode.insertBefore(el, element.nextSibling); |
25 | } | 44 | } |
26 | } else { | 45 | } else { |
@@ -30,6 +49,7 @@ exports.ElementController = Montage.create(Component, { | |||
30 | if(styles) { | 49 | if(styles) { |
31 | this.application.ninja.stylesController.setElementStyles(el, styles); | 50 | this.application.ninja.stylesController.setElementStyles(el, styles); |
32 | } | 51 | } |
52 | */ | ||
33 | } | 53 | } |
34 | }, | 54 | }, |
35 | 55 | ||