diff options
author | Valerio Virgillito | 2012-05-03 16:02:23 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-03 16:02:23 -0700 |
commit | 882f4f4b7427170ff3c3fc76a0ccd727c022bb63 (patch) | |
tree | 1efc021a187f12a50a44eedbe24a1c0355dfdafb /js/controllers/elements | |
parent | 59aaf2510ac1b0d7e8bf8732d33597deef5690fc (diff) | |
parent | eb17fe1bbd05ad260e8a56918a3b396a03767e04 (diff) | |
download | ninja-882f4f4b7427170ff3c3fc76a0ccd727c022bb63.tar.gz |
Merge branch 'refs/heads/master' into data-id
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 452d09f1..ea5fe4af 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -11,7 +11,18 @@ exports.ElementController = Montage.create(Component, { | |||
11 | 11 | ||
12 | addElement: { | 12 | addElement: { |
13 | value: function(el, styles) { | 13 | value: function(el, styles) { |
14 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | 14 | if(this.application.ninja.timeline.currentLayerSelected) { |
15 | var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); | ||
16 | |||
17 | if(selectedLayerIndex === 0) { | ||
18 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | ||
19 | } else { | ||
20 | var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; | ||
21 | element.parentNode.insertBefore(el, element.nextSibling); | ||
22 | } | ||
23 | } else { | ||
24 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | ||
25 | } | ||
15 | // Nested elements - TODO make sure the CSS is correct before nesting elements | 26 | // Nested elements - TODO make sure the CSS is correct before nesting elements |
16 | // this.application.ninja.currentSelectedContainer.appendChild(el); | 27 | // this.application.ninja.currentSelectedContainer.appendChild(el); |
17 | if(styles) { | 28 | if(styles) { |