aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/body-controller.js30
-rwxr-xr-xjs/controllers/elements/component-controller.js4
-rwxr-xr-xjs/controllers/elements/element-controller.js22
-rwxr-xr-xjs/controllers/elements/shapes-controller.js4
4 files changed, 54 insertions, 6 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 14aeae24..7a3a66f5 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -13,7 +13,7 @@ exports.BodyController = Montage.create(ElementController, {
13 set3DProperties: { 13 set3DProperties: {
14 value: function(el, props, update3DModel) { 14 value: function(el, props, update3DModel) {
15 var dist = props["dist"], mat = props["mat"]; 15 var dist = props["dist"], mat = props["mat"];
16 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")", true); 16 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")");
17 17
18 el.elementModel.props3D.matrix3d = mat; 18 el.elementModel.props3D.matrix3d = mat;
19 el.elementModel.props3D.perspectiveDist = dist; 19 el.elementModel.props3D.perspectiveDist = dist;
@@ -28,11 +28,39 @@ exports.BodyController = Montage.create(ElementController, {
28 28
29 getProperty: { 29 getProperty: {
30 value: function(el, p) { 30 value: function(el, p) {
31 switch(p) {
32 case "background" :
33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true));
34 case "border":
35 return 0;
36 case "height":
37 case "width":
38 case "-webkit-transform-style":
39 return this.application.ninja.stylesController.getElementStyle(el, p, true, true);
40 default:
41 return ElementController.getProperty(el, p, true, true);
42 //console.log("Undefined Stage property ", p);
43 }
31 } 44 }
32 }, 45 },
33 46
34 setProperty: { 47 setProperty: {
35 value: function(el, p, value) { 48 value: function(el, p, value) {
49 switch(p) {
50 case "body-background":
51 case "background":
52 this.application.ninja.stylesController.setElementStyle(el, "background-color", value);
53 break;
54 case "overflow":
55 case "width":
56 case "height":
57 case "-webkit-transform-style":
58 this.application.ninja.stylesController.setElementStyle(el, p, value);
59 this.application.ninja.stage.updatedStage = true;
60 break;
61 default:
62 console.log("Undefined property ", p, "for the Body Controller");
63 }
36 } 64 }
37 }, 65 },
38 66
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index d902e4a1..5b0aaeac 100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -11,7 +11,7 @@ exports.ComponentController = Montage.create(ElementController, {
11 11
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); 14 var component = el.controller || this.application.ninja.currentDocument.model.getComponentFromElement(el);
15 15
16 switch(prop) { 16 switch(prop) {
17 case "id": 17 case "id":
@@ -34,7 +34,7 @@ exports.ComponentController = Montage.create(ElementController, {
34 34
35 setProperty: { 35 setProperty: {
36 value: function(el, p, value) { 36 value: function(el, p, value) {
37 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); 37 var component = el.controller || this.application.ninja.currentDocument.model.getComponentFromElement(el);
38 38
39 switch(p) { 39 switch(p) {
40 case "id": 40 case "id":
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 20225c61..675176e9 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -11,13 +11,32 @@ exports.ElementController = Montage.create(Component, {
11 11
12 addElement: { 12 addElement: {
13 value: function(el, styles) { 13 value: function(el, styles) {
14 // Updated to use new methods in TimelinePanel. JR.
15 var insertionIndex = this.application.ninja.timeline.getInsertionIndex();
16 if (insertionIndex === false) {
17 this.application.ninja.currentSelectedContainer.appendChild(el);
18 } else {
19 if (insertionIndex === 0) {
20 this.application.ninja.currentSelectedContainer.appendChild(el);
21 } else {
22 var element = this.application.ninja.timeline.arrLayers[insertionIndex].layerData.stageElement;
23 element.parentNode.insertBefore(el, element.nextSibling);
24 }
25 }
26
27 if(styles) {
28 this.application.ninja.stylesController.setElementStyles(el, styles);
29 }
30
31 /*
32 // Old methods. Kept for reference. Delete if not needed. JR.
14 if(this.application.ninja.timeline.currentLayerSelected) { 33 if(this.application.ninja.timeline.currentLayerSelected) {
15 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); 34 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
16 35
17 if(selectedLayerIndex === 0) { 36 if(selectedLayerIndex === 0) {
18 this.application.ninja.currentSelectedContainer.appendChild(el); 37 this.application.ninja.currentSelectedContainer.appendChild(el);
19 } else { 38 } else {
20 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.elementsList[0]; 39 var element = this.application.ninja.timeline.arrLayers[selectedLayerIndex].layerData.stageElement;
21 element.parentNode.insertBefore(el, element.nextSibling); 40 element.parentNode.insertBefore(el, element.nextSibling);
22 } 41 }
23 } else { 42 } else {
@@ -27,6 +46,7 @@ exports.ElementController = Montage.create(Component, {
27 if(styles) { 46 if(styles) {
28 this.application.ninja.stylesController.setElementStyles(el, styles); 47 this.application.ninja.stylesController.setElementStyles(el, styles);
29 } 48 }
49 */
30 } 50 }
31 }, 51 },
32 52
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e9a5f865..38f133b5 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -213,7 +213,7 @@ exports.ShapesController = Montage.create(CanvasController, {
213 default: 213 default:
214 CanvasController.setProperty(el, p, value); 214 CanvasController.setProperty(el, p, value);
215 } 215 }
216 this.application.ninja.documentController.activeDocument.needsSave = true; 216 this.application.ninja.documentController.activeDocument.model.needsSave = true;
217 } 217 }
218 }, 218 },
219 219
@@ -559,7 +559,7 @@ exports.ShapesController = Montage.create(CanvasController, {
559 } 559 }
560 } 560 }
561 el.elementModel.shapeModel.GLWorld.render(); 561 el.elementModel.shapeModel.GLWorld.render();
562 this.application.ninja.documentController.activeDocument.needsSave = true; 562 this.application.ninja.documentController.activeDocument.model.needsSave = true;
563 } 563 }
564 }, 564 },
565 565