aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/element-controller.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-05-07 16:30:19 -0700
committerJohn Mayhew2012-05-07 16:30:19 -0700
commitdb4ba95f50148198759dde503ec1c778184d9dbe (patch)
tree8b79ad58108af2f17d15abc8cdc33d35229ab20d /js/controllers/elements/element-controller.js
parent843d8ea8ee58a54bcb71d7b28dbf78fae153b491 (diff)
parent526e423e4a2734c2b139af23911e912452a4443f (diff)
downloadninja-db4ba95f50148198759dde503ec1c778184d9dbe.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/components/layout/tools-list.reel/tools-list.html js/components/layout/tools-properties.reel/tools-properties.html js/components/tools-properties/brush-properties.reel/brush-properties.html js/components/tools-properties/fill-properties.reel/fill-properties.html js/components/tools-properties/pen-properties.reel/pen-properties.html js/components/tools-properties/pencil-properties.reel/pencil-properties.html js/components/tools-properties/selection-properties.reel/selection-properties.html js/components/tools-properties/shape-properties.reel/shape-properties.html js/components/tools-properties/tag-properties.reel/tag-properties.html js/components/tools-properties/text-properties.reel/text-properties.html
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 }