aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/element-controller.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-05-22 13:22:26 -0700
committerPushkar Joshi2012-05-22 13:22:26 -0700
commit01dbc1f329a95bc7e3b93224543d88ad5bdbd315 (patch)
treeceb527713554f506c537168e36a10452cd09ad10 /js/controllers/elements/element-controller.js
parentb9262c831952e77135b79c2de7c455d5e7ff0589 (diff)
parentc37a876b373ddc7cb19277aaeaa6bb2d2d5a50ac (diff)
downloadninja-01dbc1f329a95bc7e3b93224543d88ad5bdbd315.tar.gz
Merge branch 'master' into brushtool
Diffstat (limited to 'js/controllers/elements/element-controller.js')
-rwxr-xr-xjs/controllers/elements/element-controller.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 452d09f1..20225c61 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -11,9 +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 // Nested elements - TODO make sure the CSS is correct before nesting elements 15 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
16 // this.application.ninja.currentSelectedContainer.appendChild(el); 16
17 if(selectedLayerIndex === 0) {
18 this.application.ninja.currentSelectedContainer.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.currentSelectedContainer.appendChild(el);
25 }
26
17 if(styles) { 27 if(styles) {
18 this.application.ninja.stylesController.setElementStyles(el, styles); 28 this.application.ninja.stylesController.setElementStyles(el, styles);
19 } 29 }