aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorPushkar Joshi2012-06-11 14:07:13 -0700
committerPushkar Joshi2012-06-11 14:07:13 -0700
commit71bc93ad0d53a77d70c688b2b3aacf694dd1de91 (patch)
treea432a4652bf7c96aea72a22bf27946eeee8fc4a5 /js/controllers
parent76db3eb0aa4ffe9e75812db570c793e9f852f853 (diff)
parent756cbfad2b98b300af8db3793aa21718b88dd950 (diff)
downloadninja-71bc93ad0d53a77d70c688b2b3aacf694dd1de91.tar.gz
Merge branch 'master' into brushtool
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/body-controller.js9
-rwxr-xr-xjs/controllers/elements/controller-factory.js4
-rwxr-xr-xjs/controllers/elements/element-controller.js8
-rwxr-xr-xjs/controllers/elements/shapes-controller.js2
-rwxr-xr-xjs/controllers/styles-controller.js4
5 files changed, 16 insertions, 11 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 7a3a66f5..0dc11b82 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -30,7 +30,8 @@ exports.BodyController = Montage.create(ElementController, {
30 value: function(el, p) { 30 value: function(el, p) {
31 switch(p) { 31 switch(p) {
32 case "background" : 32 case "background" :
33 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color", false, true)); 33 case "background-color":
34 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color"));
34 case "border": 35 case "border":
35 return 0; 36 return 0;
36 case "height": 37 case "height":
@@ -47,8 +48,8 @@ exports.BodyController = Montage.create(ElementController, {
47 setProperty: { 48 setProperty: {
48 value: function(el, p, value) { 49 value: function(el, p, value) {
49 switch(p) { 50 switch(p) {
50 case "body-background":
51 case "background": 51 case "background":
52 case "background-color":
52 this.application.ninja.stylesController.setElementStyle(el, "background-color", value); 53 this.application.ninja.stylesController.setElementStyle(el, "background-color", value);
53 break; 54 break;
54 case "overflow": 55 case "overflow":
@@ -71,7 +72,7 @@ exports.BodyController = Montage.create(ElementController, {
71 72
72 getPerspectiveDist: { 73 getPerspectiveDist: {
73 value: function(el) { 74 value: function(el) {
74 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 75 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
75 return el.elementModel.props3D.perspectiveDist; 76 return el.elementModel.props3D.perspectiveDist;
76 } else { 77 } else {
77 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); 78 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true);
@@ -83,7 +84,7 @@ exports.BodyController = Montage.create(ElementController, {
83 84
84 getMatrix: { 85 getMatrix: {
85 value: function(el) { 86 value: function(el) {
86 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) 87 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d)
87 { 88 {
88 return el.elementModel.props3D.matrix3d.slice(0); 89 return el.elementModel.props3D.matrix3d.slice(0);
89 } 90 }
diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js
index 3ac3fe14..2d2a5cd1 100755
--- a/js/controllers/elements/controller-factory.js
+++ b/js/controllers/elements/controller-factory.js
@@ -8,7 +8,6 @@ var Montage = require("montage/core/core").Montage;
8 8
9var BodyController = require("js/controllers/elements/body-controller").BodyController, 9var BodyController = require("js/controllers/elements/body-controller").BodyController,
10 BlockController = require("js/controllers/elements/block-controller").BlockController, 10 BlockController = require("js/controllers/elements/block-controller").BlockController,
11 StageController = require("js/controllers/elements/stage-controller").StageController,
12 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, 11 ShapesController = require("js/controllers/elements/shapes-controller").ShapesController,
13 ImageController = require("js/controllers/elements/image-controller").ImageController, 12 ImageController = require("js/controllers/elements/image-controller").ImageController,
14 VideoController = require("js/controllers/elements/video-controller").VideoController, 13 VideoController = require("js/controllers/elements/video-controller").VideoController,
@@ -27,7 +26,8 @@ exports.ControllerFactory = Montage.create(Montage, {
27 if(value.indexOf("block") !== -1) { 26 if(value.indexOf("block") !== -1) {
28 return BlockController; 27 return BlockController;
29 } else if(value.indexOf("stage") !== -1) { 28 } else if(value.indexOf("stage") !== -1) {
30 return StageController; 29// return StageController;
30 alert("Calling the stage controller. Should not be calling this object");
31 } else if(value.indexOf("body") !== -1) { 31 } else if(value.indexOf("body") !== -1) {
32 return BodyController; 32 return BodyController;
33 } else if(value.indexOf("shape") !== -1) { 33 } else if(value.indexOf("shape") !== -1) {
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 941e05ba..4a02e9a3 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -37,7 +37,7 @@ exports.ElementController = Montage.create(Component, {
37 // Remove the element from the DOM and clear the GLWord. 37 // Remove the element from the DOM and clear the GLWord.
38 removeElement: { 38 removeElement: {
39 value: function(el) { 39 value: function(el) {
40 if(el.elementModel && el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) { 40 if(el.elementModel.shapeModel && el.elementModel.shapeModel.GLWorld) {
41 el.elementModel.shapeModel.GLWorld.clearTree(); 41 el.elementModel.shapeModel.GLWorld.clearTree();
42 } 42 }
43 el.parentNode.removeChild(el); 43 el.parentNode.removeChild(el);
@@ -277,7 +277,7 @@ exports.ElementController = Montage.create(Component, {
277 // Routines to get/set 3D properties 277 // Routines to get/set 3D properties
278 get3DProperty: { 278 get3DProperty: {
279 value: function(el, prop) { 279 value: function(el, prop) {
280 if(el.elementModel && el.elementModel.props3D) { 280 if(el.elementModel.props3D) {
281 return el.elementModel.props3D[prop]; 281 return el.elementModel.props3D[prop];
282 } 282 }
283 } 283 }
@@ -285,7 +285,7 @@ exports.ElementController = Montage.create(Component, {
285 285
286 getMatrix: { 286 getMatrix: {
287 value: function(el) { 287 value: function(el) {
288 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) { 288 if(el.elementModel.props3D && el.elementModel.props3D.matrix3d) {
289 return el.elementModel.props3D.matrix3d.slice(0); 289 return el.elementModel.props3D.matrix3d.slice(0);
290 } else { 290 } else {
291 var mat; 291 var mat;
@@ -305,7 +305,7 @@ exports.ElementController = Montage.create(Component, {
305 305
306 getPerspectiveDist: { 306 getPerspectiveDist: {
307 value: function(el) { 307 value: function(el) {
308 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) { 308 if(el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) {
309 return el.elementModel.props3D.perspectiveDist; 309 return el.elementModel.props3D.perspectiveDist;
310 } else { 310 } else {
311 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); 311 var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false);
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 845e7dc2..9fc9b576 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -133,7 +133,7 @@ exports.ShapesController = Montage.create(CanvasController, {
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;
136 canvas.elementModel = el.elementModel; 136 canvas._model = el.elementModel;
137 this.toggleWebGlMode(canvas, value); 137 this.toggleWebGlMode(canvas, value);
138 this.application.ninja.elementMediator.replaceElement(canvas, el); 138 this.application.ninja.elementMediator.replaceElement(canvas, el);
139 break; 139 break;
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 83722184..a25a05df 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -154,6 +154,10 @@ var stylesController = exports.StylesController = Montage.create(Component, {
154 styles['-webkit-transform-style'] = 'preserve-3d'; 154 styles['-webkit-transform-style'] = 'preserve-3d';
155 needsRule = true; 155 needsRule = true;
156 } 156 }
157 if(this.getElementStyle(this.currentDocument.model.documentRoot, "background-color", false, false) == null) {
158 styles['background-color'] = "transparent";
159 needsRule = true;
160 }
157 161
158 if(needsRule) { 162 if(needsRule) {
159 rule = this.addRule('.ninja-body{}'); 163 rule = this.addRule('.ninja-body{}');