aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorEric Guzman2012-05-10 14:51:31 -0700
committerEric Guzman2012-05-10 14:51:31 -0700
commit39f23ad4868482f395d2e210490a2d73545a9d84 (patch)
treec702d67585f72cddf55932411e7100133bc58452 /js/controllers/elements
parent733e16b55a6de807cdbb60b0f2cea36fc1619fd4 (diff)
parent632a53278826a33506b302b573ee0681840f2d6c (diff)
downloadninja-39f23ad4868482f395d2e210490a2d73545a9d84.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Conflicts: js/panels/CSSPanel/ComputedStyleSubPanel.reel/ComputedStyleSubPanel.html
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/controller-factory.js2
-rwxr-xr-xjs/controllers/elements/element-controller.js16
-rwxr-xr-xjs/controllers/elements/shapes-controller.js2
3 files changed, 16 insertions, 4 deletions
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js
index 1bbbbce0..3ac3fe14 100755
--- a/js/controllers/elements/controller-factory.js
+++ b/js/controllers/elements/controller-factory.js
@@ -42,6 +42,8 @@ exports.ControllerFactory = Montage.create(Montage, {
42 return ImageController; 42 return ImageController;
43 } else if(value.indexOf("video") !== -1) { 43 } else if(value.indexOf("video") !== -1) {
44 return VideoController; 44 return VideoController;
45 } else {
46 return BlockController;
45 } 47 }
46 } catch (err) { 48 } catch (err) {
47 console.log("Could not create Controller Factory " + err); 49 console.log("Could not create Controller Factory " + err);
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 }
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 8d7b74f0..e9a5f865 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -129,7 +129,7 @@ exports.ShapesController = Montage.create(CanvasController, {
129 el.elementModel.shapeModel.GLWorld.render(); 129 el.elementModel.shapeModel.GLWorld.render();
130 break; 130 break;
131 case "useWebGl": 131 case "useWebGl":
132 canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); 132 canvas = njModule.NJUtils.make("canvas", el.className, this.application.ninja.currentDocument);
133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); 133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
134 canvas.width = el.width; 134 canvas.width = el.width;
135 canvas.height = el.height; 135 canvas.height = el.height;