aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/element-controller.js
diff options
context:
space:
mode:
authorJon Reid2012-05-04 14:56:24 -0700
committerJon Reid2012-05-04 14:56:24 -0700
commita6dd2917edcfeca1be7553e03281ddd538422ae1 (patch)
treee6846626bf1e967e80bcd652f6a76bb97abb1789 /js/controllers/elements/element-controller.js
parent7fc185cc08b2ba912dbc7bce96f6a465c1dd6dbf (diff)
parent8964e070fa760d23c2de272ca36b8d9beba6007d (diff)
downloadninja-a6dd2917edcfeca1be7553e03281ddd538422ae1.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'js/controllers/elements/element-controller.js')
-rwxr-xr-xjs/controllers/elements/element-controller.js13
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) {