diff options
author | Valerio Virgillito | 2012-05-03 13:31:02 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-03 13:31:02 -0700 |
commit | a68c52ec84248cc1d8393d277edab6a4d3353c7e (patch) | |
tree | 57e02dbd48df47ccc73311212ae562bdf5613f80 /js/controllers/elements | |
parent | 691beb1c39fc0baa683f1fc56cbc519fe58f306d (diff) | |
parent | 92e7297c153b432ede5b95d86cd934c990ebe768 (diff) | |
download | ninja-a68c52ec84248cc1d8393d277edab6a4d3353c7e.tar.gz |
Merge branch 'Master-Dom-Manipulation' of https://github.com/ntfx47/ninja-internal
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 452d09f1..a7d99466 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -11,7 +11,19 @@ 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 | |||
24 | }else{ | ||
25 | this.application.ninja.currentDocument.documentRoot.appendChild(el); | ||
26 | } | ||
15 | // Nested elements - TODO make sure the CSS is correct before nesting elements | 27 | // Nested elements - TODO make sure the CSS is correct before nesting elements |
16 | // this.application.ninja.currentSelectedContainer.appendChild(el); | 28 | // this.application.ninja.currentSelectedContainer.appendChild(el); |
17 | if(styles) { | 29 | if(styles) { |